[TUHS] History of #! interpretation in Unix

John Cowan cowan at mercury.ccil.org
Mon Jan 17 07:37:38 AEST 2011


Sven Mascheck scripsit:

> who (or what system) do you mean was the 2nd?

That was hypothetical.

Trying again:  "It's unlikely that two different people chose #! as the
executable-script mark independently."

> With /bin/sh you actually meant any shell calling "itself"?
> Otherwise I'm afraid, I have some difficulties following you.

I mean that whereas (t)csh uses /bin/sh to run scripts with no
shebangs, the Posix-compatible shells execute scripts with no
shebangs directly.  And this is Bad.

> > IMHO the Posix sh definition should be extended so that all
> > shells claiming Posix-compliance should do shebangs.
> 
> Shells themselves should implement it, not the kernel?

It might be too much to ask the kernel to do, especially on
non-traditional Posix systems like z/OS.

> There was a working group resolution to standardize #!, which didn't
> make it, http://www.opengroup.org/platform/resolutions/bwg2000-004.html
> you could chime in

I see the problem now: a portable awk script, for example, can't assume
that the Posix awk is in /usr/bin/awk, so "#!/usr/bin/awk" might get the
wrong awk.  So the feature is not worth standardizing for Posix.

-- 
[W]hen I wrote it I was more than a little              John Cowan
febrile with foodpoisoning from an antique carrot       cowan at ccil.org
that I foolishly ate out of an illjudged faith          http://ccil.org/~cowan
in the benignancy of vegetables.  --And Rosta



More information about the TUHS mailing list