[comp.lang.c] csh, exit, &&, ||

chris@mimsy.UUCP (Chris Torek) (01/24/88)

(I overrode Rich's followup-to header, since there are buggy csh's out
there.)
In article <310@fig.bbn.com> rsalz@bbn.com (Rich Salz) writes:
>The use of && and || in csh is the opposite of that in /bin/sh.
>	/bin/sh -c "/bin/test -d foo || mkdir foo"
>Means if the foo directory doesn't exist, make it. ...
>	/bin/csh -c "/bin/test -d foo || mkdir foo"
>will never make the directory, or mkdir will spit if it already exists.

BUZZ!

Sorry, contestant number 3.

:-)

Old versions of the C shell did indeed have this bug.  It has been
fixed for years.  If your C shell does this, complain to your vendor
(or upgrade from 3BSD!).  I believe the documentation has always
claimed that the C shell's `&&' and `||' constructs work in the
same way as the Bourne shell's.
-- 
In-Real-Life: Chris Torek, Univ of MD Comp Sci Dept (+1 301 454 7163)
Domain:	chris@mimsy.umd.edu	Path:	uunet!mimsy!chris