Path: utzoo!attcan!utgpu!watserv1!watmath!uunet!wuarchive!zaphod.mps.ohio-state.edu!usc!ucsd!ucsdhub!cuuxun!cuuxb!mmengel From: mmengel@cuuxb.ATT.COM (Marc W. Mengel) Newsgroups: unix-pc.general Subject: Re: ln ksh /bin/sh (was: second disk partitions on UNIXPC) Message-ID: <4365@cuuxb.ATT.COM> Date: 12 Dec 89 16:26:33 GMT References: <1717@mtunb.ATT.COM> <12086@cbnews.ATT.COM> <2077@sialis.mn.org> Reply-To: mmengel@cuuxb.UUCP (Marc W. Mengel) Distribution: unix-pc Organization: AT&T-DSD, System Engineering for Resellers, Lisle IL Lines: 32 In article <2077@sialis.mn.org> rjg@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@cuuxb.att.com attmail!mmengel ...!{lll-crg|att}!cuuxb!mmengel