perlboy_emeritus has asked for the wisdom of the Perl Monks concerning the following question:
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 -wddepending 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 directoryThe 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.
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: shebang anomaly
by choroba (Cardinal) on Apr 18, 2018 at 21:16 UTC | |
by perlboy_emeritus (Scribe) on Apr 18, 2018 at 22:48 UTC | |
by huck (Prior) on Apr 19, 2018 at 00:00 UTC | |
by QM (Parson) on Apr 19, 2018 at 09:18 UTC | |
by pryrt (Abbot) on Apr 19, 2018 at 13:54 UTC | |
by bliako (Abbot) on Apr 19, 2018 at 09:46 UTC | |
by perlboy_emeritus (Scribe) on Apr 20, 2018 at 15:27 UTC | |
by Anonymous Monk on Apr 20, 2018 at 16:51 UTC | |
| |
by bliako (Abbot) on Apr 20, 2018 at 18:51 UTC | |
Re: shebang anomaly
by kcott (Archbishop) on Apr 19, 2018 at 11:26 UTC | |
by perlboy_emeritus (Scribe) on Apr 20, 2018 at 16:23 UTC | |
Re: shebang anomaly
by learnedbyerror (Monk) on Apr 22, 2018 at 21:27 UTC |