[TUHS] History of #! interpretation in Unix

Tim Bradshaw tfb at tfeb.org
Mon Jan 17 20:09:40 AEST 2011

On 16 Jan 2011, at 20:17, John Cowan wrote:

> 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.

One possibility is that there was prior art for "!" meaning "run in a shell" which gave various people the same idea independently: in a script it needs to be commented out so the shell will not barf, so you pretty naturally get "#!" as the magic sequence.  That's really arguing that the inventions were not independent but they were both copying from something else.

The obvious place that "!" might have come from is ed: it seems to have been there essentially for ever (the 1st edition manuals have it).


More information about the TUHS mailing list