[TUHS] History of #! interpretation in Unix

Sven Mascheck mascheck at in-ulm.de
Thu Jan 20 06:35:06 AEST 2011


Cyrille Lefevre wrote:

> yet another reference but more in the spirit of what csh does, it only  
> checks for a simple hash (#), no explaim mark (!), and is enclosed in  
> UCB_SCRIPT define.
>
> http://minnie.tuhs.org/cgi-bin/utree.pl?file=2.9BSD/usr/src/sys/sys/sys1.c

Perhaps you missed the ! in the macro?
#define SCRMAG '#!'

> 2.11 BSD seems to have an enhanced version of this feature in the sense  
> where the shell path may be followed by some arguments (i.e.: /bin/sh -x)

Yes, #! originally had not implemented arguments at all (this even applies
to 386BSD).  Arguments ("all in one") came with 4.2BSD and later, variations
appeared like splitting up into argv[] or delivering only the "first" argument.
-- 
http://www.in-ulm.de/~mascheck/various/shebang/#results



More information about the TUHS mailing list