csh scripts on sys V question
Griff Smith
ggs at ulysses.UUCP
Fri Nov 21 01:35:09 AEST 1986
> In article <787 at chinet.UUCP> megabyte at 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
>
> '#' '!' <program name>
>
> and program name != '/bin/sh' or 'sh'
>
> Anybody have any problems with this?
> --
> Larry McVoy mcvoy at 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 at ulysses.uucp
More information about the Comp.unix.questions
mailing list