Path: utzoo!utgpu!water!watmath!clyde!ima!bbn!bbn.com!rsalz From: rsalz@bbn.com (Rich Salz) Newsgroups: comp.lang.c Subject: Re: exit(-1), 0 is sometimes magic Keywords: exit, zero, shells Message-ID: <310@fig.bbn.com> Date: 23 Jan 88 21:32:05 GMT References: <502@cresswell.quintus.UUCP> <6935@brl-smoke.ARPA> <1179@wjvax.UUCP> <1234@nmtsun.nmt.edu> <562@cresswell.quintus.UUCP> Followup-To: comp.unix.questions Organization: BBN Laboratories, Cambridge MA Lines: 28 >>I might be wrong. >You are. So are you. :-) > sh(1): ... > Control structures: Cmd1 && Cmd2 executes Cmd2 iff Cmd1 returns > a zero exit status, Cmd1 || Cmd2 executes Cmd2 iff Cmd1 returns ... > csh(1): > ... && and || are as in sh(1); ... Nope. 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. That is, /bin/sh does the "conceptually right thing" in that it takes a||b to mean, do b if a failed. The Cshell takes a||b in the mathematical sense; do b if a does an exit(0): /bin/csh -c "/bin/test -d foo || mkdir foo" will never make the directory, or mkdir will spit if it already exists. This has stopped being an comp.lang.c.ansii-bash issue, so I'm directing followups to comp.unix.questions /r$ -- For comp.sources.unix stuff, mail to sources@uunet.uu.net.