Xref: utzoo comp.unix.i386:8423 comp.unix.wizards:23752 Path: utzoo!utgpu!news-server.csri.toronto.edu!mailrus!ames!decwrl!sdd.hp.com!samsung!cs.utexas.edu!swrinde!ucsd!pacbell.com!pacbell!att!cbnewse!danj1 From: Dan_Jacobson@ATT.COM Newsgroups: comp.unix.i386,comp.unix.wizards Subject: cd failure killing script [Re: Interactive 2.2 File zapper] Message-ID: <1990Aug3.022641.28848@cbnewse.att.com> Date: 3 Aug 90 02:26:41 GMT References: <772@essnj1.ESSNJAY.COM> <2108@cirrusl.UUCP> Sender: danj1@cbnewse.att.com (Dan Jacobson) Followup-To: comp.unix.wizards Organization: AT&T-BL, Naperville IL, USA Lines: 16 dhesi%cirrusl@oliveb.ATC.olivetti.com (Rahul Dhesi) writes: > cd /lost+found; find . -mtime +14 -exec rm -rf {} \; >If the cd fails, no damage is done, because the rest of the line is not >executed. Any sensible shell ought to let at least this work, even if >it doesn't abort the entire script. Saying that there should be a special case just for the cd command, and just for the rest of this line is ripping up the whole uniformity and generality of the shell [/bin/sh family of shells assumed]. If you want a failed cd to kill the script, then do "set -e" or "cd dir || exit 1". For just missing the rest of the line: "cd dir && bla bla bla". [I'm speaking from a general UNIX view, and don't even read the i386 newsgroup, Followup-To: comp.unix.wizards] -- Dan_Jacobson@ATT.COM +1-708-979-6364