Interactive 2.2 File zapper.
Dave Hammond
daveh at marob.masa.com
Sat Aug 4 07:41:04 AEST 1990
In article <2108 at cirrusl.UUCP> dhesi%cirrusl at 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 at marob.masa.com
uunet!masa.com!marob!daveh
More information about the Comp.unix.wizards
mailing list