cd failure killing script [Re: Interactive 2.2 File zapper]

Leslie Mikesell les at chinet.chi.il.us
Tue Aug 14 07:17:16 AEST 1990


In article <9118 at jpl-devvax.JPL.NASA.GOV> lwall at jpl-devvax.JPL.NASA.GOV (Larry Wall) writes:
>In article <26C2F1A0.205B at tct.uucp> chip at tct.uucp (Chip Salzenberg) writes:
>: According to davidsen at sixhub.UUCP (bill davidsen):
>: >Yes, only ksh gives you the choice of catching the failure.
>: 
>: Bash 1.05 also continues after a "cd" failure.

>Likewise Perl.  The idiom to catch the failure is

>	chdir $dir || die "Can't cd to $dir: $!\n";

This is reasonable behaviour for perl since it doesn't claim any
compatibility with /bin/sh scripts.  Those other two mentioned above
will cause serious problems when executing scripts that are
perfectly valid for /bin/sh.  They could (should) have required a "set"
option to be done to make them operate differently.

Les Mikesell
  les at chinet.chi.il.us



More information about the Comp.unix.wizards mailing list