[ale] why bash when ksh is default?

Jeff Barber jeffb at sware.com
Mon Mar 18 10:11:42 EST 1996


Unix Guru Dude writes:

> [Michael Ivey:]

> }I may be mistaken, but I think that scripts get run by /bin/sh, unless it 
> }has a shbang.  This is unrelated to your login shell (/etc/passwd), and 
> }is tied into the way the kernel handles scripts.
> }
> }Again, I may be wrong.
> 
> I would have expected that the SHELL variable would have been used to
> run shells.  Apparently this is not the case.  Anyone else concur?

My 1.2.8 kernel fails an exec of a script with no "#!".  That means that
the shell (or perhaps a library routine) doing the exec is providing a
backup.  I've seen different ways of doing this in the past -- some shells
just try to interpret the script themselves.  Others automatically pass
it to /bin/sh.  For example, the traditional csh behavior if an exec failed
was to examine the first character of the file; if it was ':', csh itself
interpreted it, otherwise it was passed to /bin/sh.

The SHELL variable is typically used by programs that want to exec an
*interactive* shell -- it usually isn't expected to have any relevance
to an arbitrary shell script.  I'd guess that's the assumption here too.


-- Jeff






More information about the Ale mailing list