Xref: utzoo comp.unix.i386:7531 comp.unix.wizards:23286 Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!uwm.edu!zaphod.mps.ohio-state.edu!nisca.ircc.ohio-state.edu!tut.cis.ohio-state.edu!att!dptg!pegasus!mpl From: mpl@pegasus.ATT.COM (Michael P. Lindner) Newsgroups: comp.unix.i386,comp.unix.wizards Subject: Re: Interactive 2.2 File zapper. Message-ID: <4951@pegasus.ATT.COM> Date: 2 Aug 90 16:20:59 GMT References: <772@essnj1.ESSNJAY.COM> <2108@cirrusl.UUCP> Reply-To: mpl@pegasus.ATT.COM (Michael P. Lindner) Organization: AT&T Bell Labs NJ USA Lines: 42 In article <2108@cirrusl.UUCP> dhesi%cirrusl@oliveb.ATC.olivetti.com (Rahul Dhesi) writes: deleted >The last time I looked, it was an undocumented feature in sh and csh >(and probably in ksh though I didn't check) that a cd that failed would >abort the rest of the script. In fact, sh and csh (but not ksh) went a deleted >-- >Rahul Dhesi >UUCP: oliveb!cirrusl!dhesi I don't know of any undocumented feature wrt. "cd", but for safety's sake, all my shell scripts start with the line set -e which says "exit on error". Anyplace where I expect a command to fail but it's OK to go on, I put either # do something special if the command fails if command then : else echo >&2 "command failed -- exit code $?" fi # or # ignore the code - useful for those commands which # don't return a meaningful exit code command || : # or # ignore the failure - useful for things like mkdir -p $dir 2> /dev/null || : # or mv -f $files 2> /dev/null || : Mike Lindner AT&T Bell Labs attmail!mplindner