ksh script execution (Re: make importing SHELL)
David Elliott
dce at mips.COM
Sat Oct 1 08:02:24 AEST 1988
In article <10669 at ulysses.homer.nj.att.com> ggs at ulysses.homer.nj.att.com (Griff Smith) writes:
>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.
Kludges required to make this work reliably? How about the kludges
required to make it work correctly?
If you write a shell script that uses a standard command, such as
ls, and you have an alias or function called ls that runs the
output from the standard ls through a filter to change its output,
your script could fail. Unless ksh tosses all aliases and functions
when it starts a subshell, this can happen.
This is even worse when the user of the script isn't the author
and didn't set up his/her aliases in the first place (we have
many users that are using the same startup scripts they were given
when they got here, and have no idea that the command 'mail' is
an alias for a special command). How do you explain to a novice
that they have to get rid of a command they are used to using
because ksh is trying to be fancy?
--
David Elliott dce at mips.com or {ames,prls,pyramid,decwrl}!mips!dce
More information about the Comp.unix.wizards
mailing list