[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
Re: /usr/bin/env behaviour?
On 11/8/08, Malcolm Herbert <mjch%mjch.net@localhost> wrote:
> On Sun, 9 Nov 2008 03:28:09 +0100, "Rhialto" <rhialto%falu.nl@localhost>
> > On Sun 09 Nov 2008 at 11:03:20 +1100, Malcolm Herbert wrote:
> > > 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 ...
> > Here you're closest. It is the execve() system call that parses the line
> > and decides to invoke env. Unfortunately it allows only a single
> > argument.
Other systems pass the rest of the line. POSIX doesn't seem to
specify what should be done, but the #! /usr/bin/env foo method of
script execution is gaining in popularity.
The various man pages are all pretty unclear. :)
"the remaining arguments to the interpreter are arg0 through argn of
the originally exec'd file."
If any optional args are specified, they become the first (second,
...) argument to the interpreter.
The original arguments are shifted over to become the subsequent arguments.
On Linux, the entire string following the interpreter name is passed
as a single argument to the interpreter, and this string can include
Main Index |
Thread Index |