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


In reply to shebang problem on openSUSE by kcott

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.