make importing SHELL

Griff Smith ggs at ulysses.homer.nj.att.com
Sat Oct 1 01:06:17 AEST 1988


In article <4147 at bsu-cs.UUCP>, dhesi at bsu-cs.UUCP (Rahul Dhesi) writes:
> In article <13753 at mimsy.UUCP> chris at mimsy.UUCP (Chris Torek) writes:
> >More generally, the problem is that the environment variable $SHELL has
> >the meaning `user's preferred shell'...
> 
> I think the problem is that $SHELL exists at all.  It's a poor
> substitute for the #! in 4.3BSD.
> -- 
> Rahul Dhesi         UUCP:  <backbones>!{iuvax,pur-ee}!bsu-cs!dhesi

I won't contest the argument that $SHELL is overloaded.  As a
definition of "the interactive shell that I would prefer to use" it
serves well enough, but it has problems when overextended to include
program interpretation.  $SHELL would be more useful if spit into at
least two names; possibly $ISHELL (interactive) and $ESHELL (execution).

However...  #! is not a substitute.  I have heard Dave Korn argue on
several occasions that #! gets in the way.  If $SHELL is set to point
to ksh, a shell script can be executed by forking and interpreting the
script in the child (don't ask about the kludges required to make this
work reliably, I don't think I want to know).  If #! is present, ksh
must fork and exec unless it uses additional kludges to parse the rest
of the #! line to determine whether the designated interpreter is ksh.

I usually don't follow Dave's advice on this one; the "#! /bin/ksh" at
the top is good documentation of my intentions and I am not as much of
an optimizer as I used to be.
-- 
Griff Smith	AT&T (Bell Laboratories), Murray Hill
Phone:		1-201-582-7736
UUCP:		{most AT&T sites}!ulysses!ggs
Internet:	ggs at ulysses.att.com



More information about the Comp.unix.wizards mailing list