Subject: Re: Changing exec's #! behavior
To: matthew green <>
From: Andrew Brown <>
List: tech-kern
Date: 06/16/2000 11:34:26
>   >	#!/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.
if you'd asked me before this discussion started, i'd have guessed it
wouldn't do what you want, since i expected that the only the first
argument (delimited by white space) after the interpreter name would
be passed to the interpreter.

>   >which (as a one line file) works just fine as a "print column 1" program,
>   >which is perhaps pretty silly (col works better usually), but {print $1 + $2}
>   >is something that is harder other ways.
>   that's a neat use of this "function" but imho, it's not that much of a
>   feature and looks more like a bug.  what do the standards say?  perl
>standards?  heh.

yeah...i know.  what's standard anyway?  bah!


everything's posix compliant these days, but nothing interoperates.

the thing is that everything implements all of posix, but also tons of
their own extensions, which is fine, but no one else does the same
thing (since i't snot in posix and they're not require to).  all i
know is that it works "here" but not "there".  i don't know exactly
what posix is, but i know it doesn't mean things are portable.

try moving a simple shell script from linux to solaris and see what
posix means.  sure, bash is posix compliant, and so's solaris
(somewhere they have a bourne shell that does posix.../usr/xpg4/bin/sh
i think), but things don't trade nicely.

the most extreme interpretation of this situation i've seen is with
solaris, wher they have two, three, or sometimes four (if i decide
that the other three suck and install gnu dren) versions of a given
program.  /usr/xpg4/bin/sh is the closest to what i wanted to do and i
didn't think i was straying from posix.


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