Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!seismo!think!mit-eddie!ll-xn!cit-vax!ames!ucbcad!ucbvax!ulysses!ggs From: ggs@ulysses.UUCP (Griff Smith) Newsgroups: comp.unix.questions Subject: Re: csh scripts on sys V question Message-ID: <1482@ulysses.UUCP> Date: Thu, 20-Nov-86 10:35:09 EST Article-I.D.: ulysses.1482 Posted: Thu Nov 20 10:35:09 1986 Date-Received: Thu, 20-Nov-86 23:35:51 EST References: <787@chinet.UUCP> <2964@rsch.WISC.EDU> Distribution: net Organization: AT&T Bell Laboratories, Murray Hill Lines: 35 > In article <787@chinet.UUCP> megabyte@chinet.UUCP (Dr. Megabyte) writes: > >_IF_ I type "csh script". Now, is there anyway for me to set up my 3b2 so that > >I can just type "script" and have the proper shell chosen, either Bourne or > >'C'? > > As I understand it the sh is started up to handle shell scripts, right? > In Bezerkeley Unix I think the kernel figures out what program to exec. > I don't see why the sh couldn't do this. For instance, change the sh to > look at the first line and exec it if the line is of the form > > '#' '!' > > and program name != '/bin/sh' or 'sh' > > Anybody have any problems with this? > -- > Larry McVoy mcvoy@rsch.wisc.edu, It could, but the shell isn't the only path for program execution. The scheme in BSD (and V8, I think, (unless they took that one out too)) allows one to exec a shell script from within an arbitrary process. There is also a bit of a problem with assuming that the shell's name is /bin/sh. We use two names: /bin/sh and /bin/ksh. /bin/sh is the blessed version of the Korn shell, /bin/ksh is the latest version from Dave Korn. Sometimes the two are linked, sometimes they're not. The shell may not know its name; the safest assumption is for it to use a forked copy of itself only when there is no name on the initial comment line. -- Griff Smith AT&T (Bell Laboratories), Murray Hill Phone: (201) 582-7736 UUCP: {allegra|ihnp4}!ulysses!ggs Internet: ggs@ulysses.uucp