cd failure killing script [Re: Interactive 2.2 File zapper]

Wm E. Davidsen Jr davidsen at sixhub.UUCP
Tue Aug 7 12:43:52 AEST 1990


In article <3819 at auspex.auspex.com> guy at auspex.auspex.com (Guy Harris) writes:

| If you want a failed "cd" to kill the script, don't bother doing
| anything.  The SunOS 4.0.3 Bourne shell, based on the S5R3.1 one, will
| kill the script if a "cd" fails; I checked the source code to the 4.3BSD
| Bourne shell, based on the V7 one, and it appears as if it'll do the
| same.

  Yes, only ksh gives you the choice of catching the failure. In ksh you
can check status by doing something like

	cd $1 || break; do_more

where the cd will return bad status but still continue. You learn to be
VERY careful about typing "cd xxx;rm *" and other dangerous things!
-- 
bill davidsen - davidsen at sixhub.uucp (uunet!crdgw1!sixhub!davidsen)
    sysop *IX BBS and Public Access UNIX
    moderator of comp.binaries.ibm.pc and 80386 mailing list
"Stupidity, like virtue, is its own reward" -me



More information about the Comp.unix.wizards mailing list