Xref: utzoo comp.unix.i386:7523 comp.unix.wizards:23284 Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!yale!cmcl2!phri!marob!daveh From: daveh@marob.masa.com (Dave Hammond) Newsgroups: comp.unix.i386,comp.unix.wizards Subject: Re: Interactive 2.2 File zapper. Message-ID: <26B9EF70.2597@marob.masa.com> Date: 3 Aug 90 21:41:04 GMT References: <772@essnj1.ESSNJAY.COM> <2108@cirrusl.UUCP> Reply-To: daveh@marob.masa.com (Dave Hammond) Organization: ESCC, New York City Lines: 36 In article <2108@cirrusl.UUCP> dhesi%cirrusl@oliveb.ATC.olivetti.com writes: >>-- 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. The /bin/sh in both Xenix 386 and Altos Unix V/386 only aborts the script on a failed cd, if invoked as `sh script'. If the script has been made executable, and is invoked as simply `script', then sh does not abort on a failed cd: Script started [typescript] at Fri Aug 3 17:27:24 1990 daveh$ cat >foo cd /fred/ethel/wilma ; who daveh$ sh foo foo: /fred/ethel/wilma: bad directory daveh$ chmod +x foo daveh$ ./foo ./foo: /fred/ethel/wilma: not found daveh tty5E Aug 3 17:27 clifford tty02 Aug 2 00:21 daveh$ Script ended [typescript] at Fri Aug 3 17:28:04 1990 BTW, I just checked the action taken when /bin/sh sources (as in `. ./foo') the script -- there also, the script is not aborted on cd failure. -- Dave Hammond daveh@marob.masa.com uunet!masa.com!marob!daveh