Path: utzoo!attcan!uunet!convex!killer!ames!vsi1!daver!mips!dce From: dce@mips.COM (David Elliott) Newsgroups: comp.unix.wizards Subject: ksh script execution (Re: make importing SHELL) Message-ID: <4273@dunkshot.mips.COM> Date: 30 Sep 88 22:02:24 GMT References: <452@alice.marlow.uucp> <67870@sun.uucp> <67925@sun.uucp> <4147@bsu-cs.UUCP> <10669@ulysses.homer.nj.att.com> Reply-To: dce@dunkshot.UUCP (David Elliott) Organization: MIPS Computer Systems, Sunnyvale, CA Lines: 28 In article <10669@ulysses.homer.nj.att.com> ggs@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@mips.com or {ames,prls,pyramid,decwrl}!mips!dce