Xref: utzoo comp.unix.i386:7442 comp.unix.wizards:23235 Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!usc!jarthur!bridge2!3comvax!tymix!cirrusl!sunstorm!dhesi From: dhesi%cirrusl@oliveb.ATC.olivetti.com (Rahul Dhesi) Newsgroups: comp.unix.i386,comp.unix.wizards Subject: Re: Interactive 2.2 File zapper. Message-ID: <2108@cirrusl.UUCP> Date: 1 Aug 90 17:56:14 GMT References: <772@essnj1.ESSNJAY.COM> Sender: news@cirrusl.UUCP Organization: Cirrus Logic Inc. Lines: 28 >-- cd /lost+found >-- find . -mtime +14 -exec rm -rf {} \; >If there's no lost and found directory in the root file system, this deletes >everything in the system that's older than 14 days. 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 bit too far, and the statement cd dir || exit 1 would never execute the exit 1. It looks like the sh you are using has had this undocumented feature removed, resulting in disaster. Standard practice in cleanup scripts is to do a cd followed by something else on the same line: 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. -- Rahul Dhesi UUCP: oliveb!cirrusl!dhesi