[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Shell scripts (first line -- what is that called?)



On Wed, 27 Nov 1996, Johnie Ingram wrote:
> This is the first 2.1 kernel I've tried, so I don't know if its a bug
> or a feature.  (Its startup messages mentioned being POSIX-certified,
> mabye things like "#!/usr/bin/perl -w" and "#!/usr/bin/make -f" are
> unsupported now?)

Nope. It's just a bug. By the way, the "#!" is called the "magic number".
I don't know a canonical name for the rest of the line, although I've
called it the "interpreter command".

From: William Burrow <aa126@fan.nb.ca>
> Is this not the realm of the shell?  I know that the kernel looks at the 
> start of an executable to support Java, but it should not be changing it.  

The kernel looks for #! as the first two bytes in any executable. If it
finds them, it considers the rest of the line as arguments to exec(), and
adds the pathname of the file you actually exec-ed at the end.
So, if file "foo" has this line "#!	/bin/sh -v", what is actually executed
is "/bin/sh -v ./foo".

	Bruce
--
Bruce Perens K6BP   Bruce@Pixar.com
Finger Bruce@master.Debian.org for PGP public key.
PGP fingerprint = 88 6A 15 D0 65 D4 A3 A6  1F 89 6A 76 95 24 87 B3 


--
TO UNSUBSCRIBE FROM THIS MAILING LIST: e-mail the word "unsubscribe" to
debian-user-REQUEST@lists.debian.org . Trouble? e-mail to Bruce@Pixar.com


Reply to: