LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 09-19-2015, 07:11 AM   #1
PACMANchasingme
Member
 
Registered: Mar 2015
Distribution: Arch
Posts: 62

Rep: Reputation: Disabled
Symbolic links to perl scripts and other non-exectuables


hi, when I write the command ln -s I can only create a proper shortcut from exectuable files... as you can see image below there are many programs that launch themselves through perl/python/bash scripts.

http://i.imgur.com/3YWTskW.png

the shortcut I create from chrome for example is a perl script and double clicking that shortcut just launches it's text contents. I already tried chmod +x, how do I get these types of files to be real shortcuts?

Last edited by PACMANchasingme; 09-19-2015 at 07:13 AM.
 
Old 09-19-2015, 07:38 AM   #2
HMW
Member
 
Registered: Aug 2013
Location: Sweden
Distribution: Debian, Arch, Red Hat, CentOS
Posts: 773
Blog Entries: 3

Rep: Reputation: 369Reputation: 369Reputation: 369Reputation: 369
Please show the exact command you tried, e.g.:
Code:
$ ln -s /home/HMW/Slask/lq/leading_zeroes.sh /home/HMW/bin/
Also, I don't get this part:
Quote:
the shortcut I create from chrome for example is a perl script
Could you explain in more detail what it is you are doing here?

Best regards,
HMW
 
Old 09-19-2015, 08:44 AM   #3
jpollard
Senior Member
 
Registered: Dec 2012
Location: Washington DC area
Distribution: Fedora, CentOS, Slackware
Posts: 4,912

Rep: Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513
It sounds like the Perl script is not marked as executable.

The first line must also have a "#!/usr/bin/perl"

Last edited by jpollard; 09-19-2015 at 08:45 AM.
 
Old 09-19-2015, 10:19 AM   #4
PACMANchasingme
Member
 
Registered: Mar 2015
Distribution: Arch
Posts: 62

Original Poster
Rep: Reputation: Disabled
This is the contents of /usr/lib/chromium

[spoiler]
Code:
#!/usr/bin/env perl

# Simple Chromium launcher with support for Pepper Flash
#
# Some rudimentary support for user flags is provided via a chromium-flags.conf
# config file placed in $HOME/.config/ (or $XDG_CONFIG_HOME). Arguments are
# split on whitespace and shell quoting rules apply but no further parsing is
# performed. In case of improper quoting anywhere in the file, a fatal error is
# raised. Lines starting with a hash symbol (#) are skipped.

use strict;
use warnings;

use Cwd qw( abs_path );
use JSON::PP qw( decode_json );
use File::BaseDir qw( config_home );
use Text::ParseWords qw ( shellwords );

my %PEPPER_FLASH = (
	manifest => '/usr/lib/PepperFlash/manifest.json',
	plugin => '/usr/lib/PepperFlash/libpepflashplayer.so',
);

sub get_flash_version {
	open my $manifest, '<', $PEPPER_FLASH{manifest} or return;

	my $json;

	eval {
		$json = decode_json do { local $/; <$manifest> };
	};

	return $json->{version} if $json;
}

sub get_flash_flags {
	my $flash_version = get_flash_version() // '';
	my @flash_flags;

	if ($flash_version =~ /^[\d.]+$/ and -f $PEPPER_FLASH{plugin}) {
		@flash_flags = (
			"--ppapi-flash-path=$PEPPER_FLASH{plugin}",
			"--ppapi-flash-version=$flash_version");
	}

	return @flash_flags;
}

sub get_user_flags {
	my $conf_path = config_home 'chromium-flags.conf';
	open my $conf, '<', $conf_path or return;

	my @lines = grep {!/^(\s*#|\s*$)/} map { chomp; $_ } <$conf>;
	return if not @lines;

	my @user_flags = shellwords @lines;

	unless (@user_flags) {
		system '/usr/lib/chromium-launcher/launcher-errmsg',
			'Unable to parse user flags',
			"Please check $conf_path for errors (e.g. mismatched quotes).\n\n" .
			"The launcher will now exit.";
		exit 1;
	}

	return @user_flags;
}

$ENV{CHROME_WRAPPER} = abs_path($0);
$ENV{CHROME_DESKTOP} = 'chromium.desktop';

exec '/usr/lib/chromium/chromium', get_flash_flags, get_user_flags, @ARGV;
[/spoiler]

When I try to run it, or even run the /usr/lib/chromium/chromium it doesn't open the browser.

Only going to dmenu and typing chromium runs the browser, what the hell is dmenu doing that it opens properly? All I want is a file that runs chrome.
 
Old 09-19-2015, 02:18 PM   #5
jpollard
Senior Member
 
Registered: Dec 2012
Location: Washington DC area
Distribution: Fedora, CentOS, Slackware
Posts: 4,912

Rep: Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513
Umm...

You might want the exec line to be:

exec '/usr/lib/chromium/chromium' 'chromium',get_flash_flags, get_user_flags, @ARGV;

You can always debug things by adding one parameter at a time to the exec.

If it opens with no parameters (after the /usr/lib... executable), then add one until it quits working.. or works.

Last edited by jpollard; 09-19-2015 at 02:20 PM.
 
Old 09-20-2015, 05:27 AM   #6
PACMANchasingme
Member
 
Registered: Mar 2015
Distribution: Arch
Posts: 62

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by jpollard View Post
Umm...

You might want the exec line to be:

exec '/usr/lib/chromium/chromium' 'chromium',get_flash_flags, get_user_flags, @ARGV;

You can always debug things by adding one parameter at a time to the exec.

If it opens with no parameters (after the /usr/lib... executable), then add one until it quits working.. or works.
thanks for help but I don't know what to do.

I want a file that executes chrome. Every file I open all it does is just open a text editor.
 
Old 09-20-2015, 05:45 AM   #7
jpollard
Senior Member
 
Registered: Dec 2012
Location: Washington DC area
Distribution: Fedora, CentOS, Slackware
Posts: 4,912

Rep: Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513
That likely depends on the application you are using to interpret "click".

In many cases "open" means "open a file for editing".
 
Old 09-20-2015, 06:15 AM   #8
goumba
Senior Member
 
Registered: Dec 2009
Location: New Jersey, USA
Distribution: Fedora, OpenSUSE, FreeBSD, OpenBSD, macOS (hack). Past: Debian, Arch, RedHat (pre-RHEL).
Posts: 1,335
Blog Entries: 7

Rep: Reputation: 402Reputation: 402Reputation: 402Reputation: 402Reputation: 402
Quote:
Originally Posted by jpollard View Post
That likely depends on the application you are using to interpret "click".

In many cases "open" means "open a file for editing".
This is where dmenu's difference likely comes in. dmenu is intended to launch programs.

If you're double clicking in a file manager, most assume that is what you want to do, is to edit the file. At one time Nautilus would prompt by default, but that seems to have changed.

Even desktops, which in most DEs are just the file manager running a special full screen kind of mode.

What file manager/desktop are you using when you click and the file is opened for editing? A little more information would help get the answer you seek.
 
Old 09-20-2015, 10:45 AM   #9
PACMANchasingme
Member
 
Registered: Mar 2015
Distribution: Arch
Posts: 62

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by goumba View Post
This is where dmenu's difference likely comes in. dmenu is intended to launch programs.

If you're double clicking in a file manager, most assume that is what you want to do, is to edit the file. At one time Nautilus would prompt by default, but that seems to have changed.

Even desktops, which in most DEs are just the file manager running a special full screen kind of mode.

What file manager/desktop are you using when you click and the file is opened for editing? A little more information would help get the answer you seek.
I'm using thunar file manager/i3wm.
 
Old 09-20-2015, 12:01 PM   #10
norobro
Member
 
Registered: Feb 2006
Distribution: Debian Sid
Posts: 792

Rep: Reputation: 331Reputation: 331Reputation: 331Reputation: 331
Here you go: http://www.linuxquestions.org/questi...xt-4175553402/
 
1 members found this post helpful.
Old 09-20-2015, 12:38 PM   #11
PACMANchasingme
Member
 
Registered: Mar 2015
Distribution: Arch
Posts: 62

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by norobro View Post
not in a million years would I have found this solution, thanks.

It actually came up on google with "thunar execute shell script" dunno what the hell keywords I decided to use earlier this week.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] Why don't intltool perl scripts execute as perl scripts? RandomTroll Linux - Software 19 01-24-2014 03:37 PM
Symbolic links Vs Hard links sulekha Linux - General 2 10-02-2008 07:03 AM
symbolic links neocontrol Linux - Software 3 05-15-2006 12:08 AM
Symbolic links bkmesenbrink Linux - Newbie 2 11-13-2002 11:54 AM
Symbolic links Valerie Linux - Newbie 12 03-31-2002 01:49 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 05:04 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration