ln ksh /bin/sh (was: second disk partitions on UNIXPC)
Robert J. Granvin
rjg at sialis.mn.org
Wed Dec 13 15:34:37 AEST 1989
In article <4365 at cuuxb.ATT.COM> mmengel at cuuxb.UUCP (Marc W. Mengel) writes:
|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.
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 at sialis.mn.org
____National Computer Systems____ BITNET: rjg%sialis.mn.org at nic.mr.net
__National Information Services__ UUCP: ...amdahl!bungia!sialis!rjg
"Go ahead... be naughty. Save Santa the trip."
More information about the Unix-pc.general
mailing list