Help needed with conditional statement for alias in csh

Larry Wall lwall at jpl-devvax.JPL.NASA.GOV
Fri Sep 21 03:08:15 AEST 1990


In article <1990Sep20.090627.20515 at Neon.Stanford.EDU> dkeisen at Gang-of-Four.Stanford.EDU (Dave Eisen) writes:
: In article <1990Sep18.223605.29379 at eua.ericsson.se> per at 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 at jpl-devvax.jpl.nasa.gov



More information about the Comp.unix.shell mailing list