Another sed question.

P E Smee exspes at gdr.bath.ac.uk
Tue Dec 5 22:21:01 AEST 1989


In article <4694 at pinas.cs.vu.nl> maart at cs.vu.nl (Maarten Litmaath) writes:
>Probably:
>
>	#!/bin/sed 1d
>	<the rest of the script>
>
>When you try to execute this script, the kernel opens it to find out what kind
>of executable it is.  The header of a *binary* includes the size of the text,
>data and bss segments etc..  This file, however, isn't a binary: it's an
>EXECUTABLE shell script.  The kernel discovers the `#!' MAGIC NUMBER and takes
>the following word as the real executable to start.  There may be 1 option

Question is, is this #! trick actually documented anywhere?  I certainly can't
find it in any obvious place in my FM's (mostly sysV and 4.2bsd).  If so,
where?  Is it a 4.3bsd feature, or something?  (I see a quick 'mention in
passing' in J.E.Lapin's 'Portable C and Unix System Programming', which
seems to imply that it isn't -- portable, that is.)
-- 
 Paul Smee, Univ. of Bristol Comp. Centre, Bristol BS8 1TW (Tel +44 272 303132)
 Smee at bristol.ac.uk   :-)   (..!uunet!ukc!gdr.bath.ac.uk!exspes if you HAVE to)



More information about the Comp.unix.questions mailing list