Tech News
← Back to articles

#!magic, details about the shebang/hash-bang mechanism on various Unix flavours

read original related products more articles

See an old mail from Dennis Ritchie introducing the new feature, quoted in 4.0 BSD /usr/src/sys/newsys/sys1.c.

The path component newsys was an option.

It is also mentioned in /usr/src/sys/sys/TODO (that is, in the regular path),

6. Exec fixes Implement dmr's #! feature; pass string arguments through faster.

So this #! mechanism origins from Bell Labs, between Version 7 and Version 8,

and was then available on 4.0BSD (~10/'80), although not activated per default.

Two important differences to current implementations are:

The length of the line was limited to 16 (Research Unix) or 32 (BSD) bytes.

"Arguments" were not delivered.

It was then implemented by default on 4.2BSD (~09/'83), /usr/src/sys/sys/kern_exec.c by Robert Elz.

... continue reading