in reply to Perl script w/o .pl extension broken on Ubuntu?

"psr.pl works fine, psr -> No command 'psr' found, did you mean:

Why do you think you can execute the program without using its full name? All the stuff you mentioned about changing your PATH and file permissions will be immaterial if you try to run a file that doesn't exist.

Have you tried renaming the script as psr and running that?

(You don't need the script file to end in a particular extension for Perl to be able to run it ...)

The way forward always starts with a minimal test.

Replies are listed 'Best First'.
Re^2: Perl script w/o .pl extension broken on Ubuntu?
by BrianP (Acolyte) on Feb 01, 2016 at 20:14 UTC
    It's the old LINK TRICK!

    ln -s /home/brianp/bin/psr.pl /home/brianp/bin/psh/psr brianp@raptor:~$ perl -v | psr "s/^\s*$//" | head -n 2 This is perl 5, version 22, subversion 1 (v5.22.1) built for x86_64-li +nux Copyright 1987-2015, Larry Wall PATHEXT=.BAT;.pl;.EXE;.COM;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC;.PY; +.PYW
    It's Alive!

    Forcing each user to either vitiate their script names or maintain
    a parallel link system with double maintenance is most inattentive!

    Fixing such a simple problem by destroying information and abolishing
    file extensions just seems wrong-headed. Perhaps, it's the NIH syncrom;

    How about (ba)sh feature: EXEC_EXTENSION=pl:sh:py:rb ExExt?

    Having the ability to specify execution preference based not only
    on directory but also on EXTension is very handy.

    Rather like Intermittent Windshield Wipers!
    Once you have used them, they are hard to do without.

    Ford never put them on the Model T so YOU CAN'T HAVE THEM!
    How can you have your wipers both ON and OFF at the Same Time?
    That's Just Crazy!!!
    Have you tried REMOVING YOUR WINDSHIELD TO FIX THE PROBLEM?? :-)

    This is NOT a PERL PROBLEM. I was hoping that there was a
    GOOD PERL SOLUTION
    eval(($COMSPEC($cmd)) =~ m/BAD COMMAND/i) && exec(&fcmd($cmd))[0]) *!!!

    NOTE* Concept only, do not run, may fuse your North Bridge!