Xref: utzoo comp.lang.c:6927 comp.unix.questions:5343 Path: utzoo!mnetor!uunet!husc6!cmcl2!brl-adm!umd5!mimsy!chris From: chris@mimsy.UUCP (Chris Torek) Newsgroups: comp.lang.c,comp.unix.questions Subject: csh, exit, &&, || (was Re: exit(-1), 0 is sometimes magic) Message-ID: <10318@mimsy.UUCP> Date: 24 Jan 88 04:43:36 GMT References: <502@cresswell.quintus.UUCP> <6935@brl-smoke.ARPA> <1179@wjvax.UUCP> <310@fig.bbn.com> Followup-To: comp.unix.questions Organization: U of Maryland, Dept. of Computer Science, Coll. Pk., MD 20742 Lines: 23 Keywords: exit, zero, shells (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