Matthew Seaman <m.sea...@infracaninophile.co.uk> wrote:

> > It would do no good for the kernel to hand the interpreter an
> > open descriptor if the interpreter did not somehow know to read
> > the script from that open descriptor instead of opening the
> > script file by name.
>
> Errr -- no.  That's what fdescfs(5) is for.   When the kernel
> execs the interpreter, it tells the script to open /dev/fd/5 (for
> example) and doing that just connects the script to the open file
> descriptor the kernel used previously to taste the magic number
> and the #! line of the script.

which -- again absent some special arrangement in the interpreter
-- would cause the script to receive $0 as "/dev/fd/5" instead of
the actual name of the script, no?  I'd expect this to at least
break any messages that the script might try to produce via
constructs like

  echo "$0: whatever"
_______________________________________________
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to "freebsd-questions-unsubscr...@freebsd.org"

Reply via email to