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.
-
Are you posting in the right place? Check out Where do I post X? to know for sure.
-
Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
<code> <a> <b> <big>
<blockquote> <br /> <dd>
<dl> <dt> <em> <font>
<h1> <h2> <h3> <h4>
<h5> <h6> <hr /> <i>
<li> <nbsp> <ol> <p>
<small> <strike> <strong>
<sub> <sup> <table>
<td> <th> <tr> <tt>
<u> <ul>
-
Snippets of code should be wrapped in
<code> tags not
<pre> tags. In fact, <pre>
tags should generally be avoided. If they must
be used, extreme care should be
taken to ensure that their contents do not
have long lines (<70 chars), in order to prevent
horizontal scrolling (and possible janitor
intervention).
-
Want more info? How to link
or How to display code and escape characters
are good places to start.