Gabriel Genellina said:
En Sat, 03 Feb 2007 07:35:22 -0300, Peter Otten <
[email protected]>
escribió:
The shell parses that line, not Python, so you should look into its
documentation.
Bzzt! In any modestly recent Unix version (meaning fifteen years
old or younger), it has been the kernel that parsed the #! line,
not the shell.
As for *how* the kernel parses that line, it varies between Unix
versions. Linux, at least versions 2.4 and 2.6, takes everything
after the interpreter and passes it as a single argument to the
interpreter, with leading and trailing whitespace stripped. Thus
#! /usr/bin/interpreter foo bar gazonk del
will give the parameter "foo bar gazonk del" to the interpreter.
SunOS 5.10 (aka Solaris 10) on the other hand, splits the line on
whitespace and passes only the first word as parameter, and would
thus give only "foo" to the interpreter for the same #! line.
I seem to remember having used some Unix flavor that allowed
multiple words as arguments, and thus passed the four words
"foo", "bar", "gazonk" and "del" as arguments for the above #!
line, but I don't remember what Unix that was.