Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
PerlMonks  

comment on

( #3333=superdoc: print w/replies, xml ) Need Help??
Hello Monks,

I run Perl natively in macOS (v5.18.2) and in perlbrew (v5.20.3) and in debian in a VirtualBox vm (v5.24.1). The Perl code is common by design, meant to be portable and shared by all of these separate Perl environments, so my shebang line is:

#!/usr/bin/env perl -w or #!/usr/bin/env perl -wd

depending on whether I wish to debug. This shebang works correctly in macOS, either the native perl or the perlbrew perl but in debian env does not like either the -w or the -wd arguments. This, despite the (relatively) common man pages for env that assert that the command handed to env can take arguments, as in:

macOS:

env [-iv] [-P altpath] [-S string] [-u name] [name=value ...] [utility [argument ...]]

debian:

env [OPTION]... [-] [NAME=VALUE]... [COMMAND [ARG]...]

When I run perl scripts shared from macOS in debian I have to remove -w or -wd, otherwise I get:

/usr/bin/env: 'perl -w': No such file or directory

The single quotes in that error message are from bash, not my script. I have tried to quote -w and -wd but explicitly quoting those arguments does not change the outcome. The bash shell or env or whatever are treating -w and -wd as the names of files and failing to find either, barf that error message. It is important that I be able to share Perl scripts between all of these execution environments so the shebang must be the same in all. What is debian env doing that the native macOS env is not? Is this possibly a bug in GNU env (v8.26)?

I suppose, technically, this is not a Perl question, so perhaps I should post this to stack overflow or some other technical site, but I thought I'd try Monks first.


In reply to shebang anomaly by perlboy_emeritus

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, 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, 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.
  • Log In?
    Username:
    Password:

    What's my password?
    Create A New User
    Chatterbox?
    and the web crawler heard nothing...

    How do I use this? | Other CB clients
    Other Users?
    Others having an uproarious good time at the Monastery: (5)
    As of 2019-12-15 01:12 GMT
    Sections?
    Information?
    Find Nodes?
    Leftovers?
      Voting Booth?

      No recent polls found

      Notices?