Symbolic links to perl scripts and other non-exectuables
Linux - NewbieThis 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
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
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.
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.
#!/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.
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.
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.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.