kcott has asked for the wisdom of the Perl Monks concerning the following question:
I encountered a problem with the shebang line using openSUSE.
For testing purposes, I narrowed this down to one of the simplest of scripts (test_shebang.pl):
#!/usr/bin/env perl -l print 'Hello, world!';
When I attempt to run this, I get:
ken@ibm-laptop:~/tmp> test_shebang.pl /usr/bin/env: perl -l: No such file or directory
It's not a $PATH or permission issue:
ken@ibm-laptop:~/tmp> echo $PATH <list of unrelated paths>:. ken@ibm-laptop:~/tmp> which test_shebang.pl /home/ken/tmp/test_shebang.pl ken@ibm-laptop:~/tmp> ls -l test_shebang.pl -rwxr-xr-x 1 ken users 48 Mar 24 10:29 test_shebang.pl
I've checked for any problematic characters that might have been present, but found none:
ken@ibm-laptop:~/tmp> cat -vet test_shebang.pl #!/usr/bin/env perl -l$ $ print 'Hello, world!';$ $
When changing the shebang line to any of the following, the scripts run with expected output (i.e. prints "Hello, world!" with or without "\n"):
#!/usr/bin/env perl #!/usr/bin/perl -l #!/usr/bin/perl
The '-l' switch appears to work correctly from the command line:
ken@ibm-laptop:~/tmp> perl -e 'print "Hello, world!"' Hello, world!ken@ibm-laptop:~/tmp>
ken@ibm-laptop:~/tmp> perl -le 'print "Hello, world!"' Hello, world!
The platform is "openSUSE Leap 42.1" and the Software Updates notification is telling me "Your system is up to date" (after running "Check For Updates"). Other relevant info:
ken@ibm-laptop:~/tmp> perl -v | head -2 | tail -1 This is perl 5, version 18, subversion 2 (v5.18.2) built for x86_64-li +nux-thread-multi ken@ibm-laptop:~/tmp> uname -a Linux ibm-laptop 4.1.34-33-default #1 SMP PREEMPT Thu Oct 20 08:03:29 +UTC 2016 (fe18aba) x86_64 x86_64 x86_64 GNU/Linux
I'm using a borrowed laptop (the owner is not currently contactable) and I'm not overfamiliar with openSUSE: perhaps I just need to tweak a setting. Neither Super Search nor Internet searches have proved fruitful.
Any help would be appreciated.
— Ken
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: shebang problem on openSUSE [additional tests]
by kcott (Archbishop) on Mar 24, 2018 at 06:23 UTC | |
|
Re: shebang problem on openSUSE
by Anonymous Monk on Mar 24, 2018 at 10:30 UTC | |
by kcott (Archbishop) on Mar 24, 2018 at 19:57 UTC | |
|
Re: shebang problem on openSUSE
by Anonymous Monk on Mar 24, 2018 at 02:58 UTC | |
by kcott (Archbishop) on Mar 24, 2018 at 05:15 UTC | |
by beech (Parson) on Mar 24, 2018 at 06:45 UTC | |
by kcott (Archbishop) on Mar 24, 2018 at 19:49 UTC | |
by Anonymous Monk on Mar 24, 2018 at 09:30 UTC | |
by kcott (Archbishop) on Mar 24, 2018 at 19:11 UTC | |
by Anonymous Monk on Mar 24, 2018 at 03:05 UTC | |
|
Re: shebang problem on openSUSE
by Anonymous Monk on Mar 24, 2018 at 12:13 UTC |