Subject: Re: Changing exec's #! behavior
To: matthew green <>
From: Andrew Brown <>
List: tech-kern
Date: 06/16/2000 12:00:46
>   >   >   #!/usr/bin/awk NR > 1 {print $1}
>   >                      ^^^^^^^^^^^^^^^^^
>   >that is one argument 
>   depends on the context.  from the point of view of the shell, it's
>   several.  from the point of view of exec_script, it's (currently) one.
>nono, that's the point.  to the shell, it *is* one argument.  if you
>typed it at a shell, you would quote the highlighted part above.

without quotes, it looks to me like several arguments, and i'd always
assumed that the kernel didn't do things differently from userland
because it would violate the principle of least surprise.  for me, at

>   everything's posix compliant these days, but nothing interoperates.
>as far as i know, nothing specifies this behaviour *exactly*...

the closest thing i can find is in the solaris man page for exec*(3):

     An interpreter file begins with a line of the form

          #! pathname [arg]

     where pathname is the path of the interpreter, and arg is an
     optional  argument.   When  an interpreter file is executed,
     the system invokes the specified interpreter.  The  pathname
     specified  in  the interpreter file is passed as arg0 to the
     interpreter.  If arg was specified in the interpreter  file,
     it  is  passed  as  arg1  to the interpreter.  The remaining
     arguments to the interpreter are arg0 through  argn  of  the
     originally  exec'd  file.  The interpreter named by pathname
     must not be an interpreter file.

but, no, it doesn't specify how the arg is supposed to be delimited,
nor does it mention any of the limits (interpreter and arg are limited
to max 32 characters each) i thought there were.  i wonder where i got
those silly ideas...

|-----< "CODE WARRIOR" >-----|             * "ah!  i see you have the internet (Andrew Brown)                that goes *ping*!"       * "information is power -- share the wealth."