Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
PerlMonks  

Re^3: shebang problem on openSUSE

by beech (Parson)
on Mar 24, 2018 at 06:45 UTC ( #1211649=note: print w/replies, xml ) Need Help??


in reply to Re^2: shebang problem on openSUSE
in thread shebang problem on openSUSE

Hi

See perlrun , when  #!/usr/bin/env perl -l doesn't work use

#!/bin/sh #! -*-perl-*- eval 'exec perl -x -wS $0 ${1+"$@"}' if 0;

Also see https://www.in-ulm.de/~mascheck/various/shebang/#splitting which says

Splitting arguments A very few systems deliver only the first argument, some systems split + up the arguments like a shell to fill up argv[], most systems deliver all arguments as a single string. See the table b +elow. I noticed that for Linux (delivering all arguments as one strin +g), a patch to split up was suggested on the Linux kernel mailing list (de +ad link, try this page, archive.org), followed by a discussion of som +e portability issues.

See also https://unix.stackexchange.com/questions/361794/why-am-i-able-to-pass-arguments-to-usr-bin-env-in-this-case?rq=1, https://stackoverflow.com/questions/4303128/how-to-use-multiple-arguments-for-awk-with-a-shebang-i-e...

Replies are listed 'Best First'.
Re^4: shebang problem on openSUSE
by kcott (Bishop) on Mar 24, 2018 at 19:49 UTC

    ++ Thanks beech, that answers my question and resolves the issue.

    The table showing different behaviours was particularly helpful. It would appear that I have mostly been using OSes that do parse all arguments separately; for instance, I've had Mac OS X at home for the last eight years and that's what I would have used, almost exclusively, for scripts I've posted on this site. I was quite unaware that wasn't the normal case: hence my surprise at the behaviour on this borrowed laptop.

    — Ken

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1211649]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others contemplating the Monastery: (4)
As of 2021-04-18 18:48 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?