ln ksh /bin/sh (was: second disk partitions on UNIXPC)

Marc W. Mengel mmengel at cuuxb.ATT.COM
Wed Dec 13 03:26:33 AEST 1989


In article <2077 at sialis.mn.org> rjg at sialis.mn.org (Robert J. Granvin) writes:
>To clarify, consider this two line sequence (this was the source of
>much "discussion" several months ago):
>
>cd /usr/spool/uucppublic
>find . -type f -mtime +30 -exec rm -f {} \;
>[...]
>What happens if /usr/spool/uucppublic goes away?
>
>If it's running under /bin/sh, nothing.[...] under /bin/ksh, 
>the cd will fail, you [will remove $HOME, everything if root].

This is just a case of the -e flag not being turned on by default
when running scripts in ksh; something that is easily configurable
(at least if you have source), or easily put in your script, or
in crontab.  Since the -e flag is *not* documented as the default
in plain old /bin/sh, you are better off explicitly turning it
on if you rely on it, since other versions of /bin/sh might not
have it on...

So if your script read:

	set -e
	cd /usr/spool/uucppublic
	find . -type f -mtime +30 | xargs rm -f

you wouldn't do the find if /usr/spool/uucppublic wasn't
there in either shell, ever.
-- 
 Marc Mengel					mmengel at cuuxb.att.com
 						attmail!mmengel
 						...!{lll-crg|att}!cuuxb!mmengel



More information about the Unix-pc.general mailing list