command line options

David Elliott dce at mips.COM
Mon Apr 25 07:31:31 AEST 1988


In article <7746 at brl-smoke.ARPA> gwyn at brl.arpa (Doug Gwyn (VLD/VMB) <gwyn>) writes:
>In article <1864 at sugar.UUCP> peter at 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 at mips.com  or  {ames,prls,pyramid,decwrl}!mips!dce



More information about the Comp.unix.wizards mailing list