Path: utzoo!mnetor!uunet!husc6!bloom-beacon!tut.cis.ohio-state.edu!mailrus!ames!pasteur!ucbvax!decwrl!pyramid!prls!mips!dce From: dce@mips.COM (David Elliott) Newsgroups: comp.unix.wizards Subject: Re: command line options Message-ID: <2075@quacky.mips.COM> Date: 24 Apr 88 21:31:31 GMT References: <2414@zyx.UUCP> <8039@elsie.UUCP> <7628@brl-smoke.ARPA> <143@gsg.UUCP> <7634@brl-smoke.ARPA> <1864@sugar.UUCP> <7746@brl-smoke.ARPA> Reply-To: dce@quacky.UUCP (David Elliott) Organization: MIPS Computer Systems, Sunnyvale, CA Lines: 30 In article <7746@brl-smoke.ARPA> gwyn@brl.arpa (Doug Gwyn (VLD/VMB) ) writes: >In article <1864@sugar.UUCP> peter@sugar.UUCP (Peter da Silva) writes: >>Speaking of the bourne-again shell (System V shell), how do you get a shell >>function inherited by subshells? > >In the 8th Edition UNIX shell, you simply export them via the environment. How do shell scripts handle this situation? For example, assume that the user has the function rm() { myownrm -i ${1+"$@"} } where "myownrm" moves files into a "garbage can" directory. What happens when my shell script says 'rm "$Tempfile"'? Do I have to do "unset" (or otherwise undefine) each name that I use, just in case the user has a corresponding function? Sure, I could use paths, but that gets extra painful when you get tricky with functions (such as when I define things like "chmod" to be "echo chmod $mode $file" when the user gives the -n option to a script, and leave it undefined otherwise). I can't believe that this feature would be added without a way to stop it from breaking things. Then again, the importation and use of $SHELL by default in make is pretty stupid... -- David Elliott dce@mips.com or {ames,prls,pyramid,decwrl}!mips!dce