Shebang

Paul Jarc prj@po.cwru.edu
Mon Mar 8 22:33:00 GMT 2004


cgd@broadcom.com wrote:
> At Mon, 8 Mar 2004 20:50:13 +0000 (UTC), prj@po.cwru.edu wrote:
>> But you can do:
>> #!/usr/bin/env shell-script
>> ... input interpreted by shell-script here ...
...
> To quote the solaris manual page for execve:
...
>      The interpreter named by pathname must
>      not be an interpreter file.

Right.  That's why I used /usr/bin/env - which is a binary, not a
script - as the interpreter.  The rule prohibits using a script
*directly* as an interpeter of another script; that's why I wedge env
in between, to work around that rule.  When you call exec on the
meta-script, the kernel has no idea that env's argument is another
script, or that it will be exec'ed in turn.  The kernel just checks
that env itself is not a script.


paul



More information about the Gcc mailing list