NetBSD-Users archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

/usr/bin/env behaviour?



I'm trying to use /usr/bin/env in a script #! line as a portable way of
getting to the perl interpreter as follows

  #!/usr/bin/env perl
  print "foo!\n";

and this is working fine ... unfortunately, when I try to use

  #!/usr/bin/env perl -w
  print "foo!\n";

or any other arguments to the perl interpreter, env complains:

  env: perl -w: No such file or directory

yet according to the env manual synopsis, this is valid usage:

  env [-i] [name=value ...] [utility [argument ...]]

Oddly, the usage that is failing as a #! line works when run stand-alone
on the command line:

  % /usr/bin/env perl -w blah
  foo!

The host is running 4.99.70 and I haven't tested this on other versions
yet (I only have the one NetBSD host available at present) - Solaris 10
/usr/bin/env appears to have no issues with this ... 

Can others confirm this behaviour and let me know whether the fault lies
with the man page or env itself?

Thinking about it, it may not even be env's fault if /bin/sh (or
whatever is responsible for parsing the #! line) is giving env a badly
tokenised set of arguments ...

Most odd ... 

Regards,
Malcolm

-- 
Malcolm Herbert                                This brain intentionally
mjch%mjch.net@localhost                                                left 
blank



Home | Main Index | Thread Index | Old Index