[TUHS] History of #! interpretation in Unix

John Cowan cowan at mercury.ccil.org
Mon Jan 17 06:17:46 AEST 2011


Sven Mascheck scripsit:

> DMR might have known the csh-hack (and if a comment character is
> implemented anywhere, here csh, then it's obvious to use it for #!)

That might account for the "#", but not for "#!" taken together.
Having two different people invent the shebang independently (as opposed
to *implementing* it independently, as has happened many times -- 8th
Edition, SVR4, Linux, etc.) is just too improbable for me to swallow.

> > > I thought sh-like shells in general try to interprete scripts themselves
> > > upon an ENOEXEC.  Do you know certain shells which actually call "/bin/sh"?
> > 
> > Yes, seemingly bash does that too.  Bogus.
> 
> How'd you get the impression?  I can't verify this.

No, I meant that bash does what ksh does: uses itself, which means that a
shebang-free script runs differently on bash, ksh, dash.  This is IMHO
unfortunate.

> (That's the only way how executing on in POSIX shell is possible, BTW,
> because neither #! nor paths are standardized).

Good point.  IMHO the Posix sh definition should be extended so that all
shells claiming Posix-compliance should do shebangs.

-- 
John Cowan  cowan at ccil.org  http://ccil.org/~cowan
And now here I was, in a country where a right to say how the country should
be governed was restricted to six persons in each thousand of its population.
For the nine hundred and ninety-four to express dissatisfaction with the
regnant system and propose to change it, would have made the whole six
shudder as one man, it would have been so disloyal, so dishonorable, such
putrid black treason.  --Mark Twain's Connecticut Yankee



More information about the TUHS mailing list