Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.1 6/24/83; site mulga.SUN Path: utzoo!watmath!clyde!floyd!harpo!decvax!mulga!kre From: kre@mulga.SUN (Robert Elz) Newsgroups: net.unix-wizards Subject: Re: magic numbers Message-ID: <228@mulga.SUN> Date: Thu, 8-Mar-84 02:24:08 EST Article-I.D.: mulga.228 Posted: Thu Mar 8 02:24:08 1984 Date-Received: Sat, 10-Mar-84 10:43:22 EST References: <2639@alice.UUCP>, <199@opus.UUCP> Organization: Comp Sci, Melbourne Uni, Australia Lines: 17 The point of doing '#!' stuff inside the kernel is that it allows setuid interpreted programs (including 'sh' scripts as a special case). That can't be accomplished in any library routine, no matter how hard you try. With that, shell scripts become as versatile as compiled (a.out format) executables, you can ALWAYS use whichever is most appropriate, without being stopped by implementation restrictions - which is just as it should be. Another effect, is that the name of the script (interpreted program) goes in /usr/adm/acct instead of the ubiquitous 'sh'. I might add that the original idea & code to do this were by Dennis Ritchie (if my sources are correct, & they are fairly good sources I think), and I added it to 4.1bsd. Robert Elz decvax!mulga!kre ps: the code is reasonably portable, the "magic number" is the string "#!", it works, as is, whichever way your bytes are arranged. And yes, its fractionally slower than treating the magic number as some horrible octal constant!