Path: utzoo!attcan!utgpu!watserv1!watmath!uunet!fernwood!apple!sun-barr!lll-winken!brutus.cs.uiuc.edu!zaphod.mps.ohio-state.edu!tut.cis.ohio-state.edu!rutgers!umn-d-ub!umn-cs!nis!sialis!rjg From: rjg@sialis.mn.org (Robert J. Granvin) Newsgroups: unix-pc.general Subject: Re: ln ksh /bin/sh (was: second disk partitions on UNIXPC) Message-ID: <2093@sialis.mn.org> Date: 13 Dec 89 04:34:37 GMT References: <1717@mtunb.ATT.COM> <12086@cbnews.ATT.COM> <2077@sialis.mn.org> <4365@cuuxb.ATT.COM> Reply-To: rjg@sialis.mn.org (Robert J. Granvin) Distribution: unix-pc Organization: Dr. Ho Laboratory and Day Care Center Lines: 51 In article <4365@cuuxb.ATT.COM> mmengel@cuuxb.UUCP (Marc W. Mengel) writes: |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. Of course, I can argue that if you have source and know enough to enable the -e option by default, or know enough to systematically go through your system and make sure that all scripts are "safe" under ksh and have any needed modifications, that you are _keenly_ aware of the damage a ksh for sh change could make, and probably wouldn't go through the trouble or bother... But, if you really wanted to... (Remember that the vast majority of users and even System Administrators can't tell you any differences between ksh and sh. You might find a surprising number of people who don't realize that ksh offers history and aliases. These are the people one needs to be most "concerned" about. Not the people with source who know all about it...) -- ________Robert J. Granvin________ INTERNET: rjg@sialis.mn.org ____National Computer Systems____ BITNET: rjg%sialis.mn.org@nic.mr.net __National Information Services__ UUCP: ...amdahl!bungia!sialis!rjg "Go ahead... be naughty. Save Santa the trip."