Path: utzoo!utgpu!jarvis.csri.toronto.edu!clyde!uunet!mcsun!ukc!dcl-cs!gdt!gdr!exspes From: exspes@gdr.bath.ac.uk (P E Smee) Newsgroups: comp.unix.questions Subject: Re: Another sed question. Message-ID: <1989Dec5.112101.15906@gdt.bath.ac.uk> Date: 5 Dec 89 11:21:01 GMT References: <37091@ames.arc.nasa.gov> <4694@pinas.cs.vu.nl> Reply-To: exspes@gdr.bath.ac.uk (P E Smee) Organization: University of Bristol c/o University of Bath Lines: 20 In article <4694@pinas.cs.vu.nl> maart@cs.vu.nl (Maarten Litmaath) writes: >Probably: > > #!/bin/sed 1d > > >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@bristol.ac.uk :-) (..!uunet!ukc!gdr.bath.ac.uk!exspes if you HAVE to)