Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!sdd.hp.com!elroy.jpl.nasa.gov!jpl-devvax!lwall From: lwall@jpl-devvax.JPL.NASA.GOV (Larry Wall) Newsgroups: comp.unix.shell Subject: Re: Help needed with conditional statement for alias in csh Message-ID: <9583@jpl-devvax.JPL.NASA.GOV> Date: 20 Sep 90 17:08:15 GMT References: <6932.26ed237f@uwovax.uwo.ca> <26553@mimsy.umd.edu> <1990Sep18.223605.29379@eua.ericsson.se> <1990Sep20.090627.20515@Neon.Stanford.EDU> Reply-To: lwall@jpl-devvax.JPL.NASA.GOV (Larry Wall) Organization: Jet Propulsion Laboratory, Pasadena, CA Lines: 26 In article <1990Sep20.090627.20515@Neon.Stanford.EDU> dkeisen@Gang-of-Four.Stanford.EDU (Dave Eisen) writes: : In article <1990Sep18.223605.29379@eua.ericsson.se> per@erix.ericsson.se (Per Hedeland) writes: : >IMHO the best solution is to use the other conditional construct, that : >happens to be common to sh and csh, and apparently unbroken in the latter: : > : >test -s /usr/spool/mail/miller && (echo ""; echo "New mail"; echo "") : > : : Speak for your own C-shell. : : In SCO Xenix, the C-shell thinks it really is C: : : test -s /usr/spool/mail/miller : : returns 0 (assuming the file is nonempty) so the C-shell doesn't : evaluate the second half of the conditional expression. : : && and || both work exactly the opposite of how one would expect them to : work (and of how they do in fact work in the Bourne shell). So use a binary editor, go in and swap the || and &&. Or rm /bin/csh. Such malprogramming should not go unpunished. Larry Wall lwall@jpl-devvax.jpl.nasa.gov