Help needed with conditional statement for alias in csh

Greg Miller miller at uwovax.uwo.ca
Wed Sep 12 07:48:47 AEST 1990


In article <6929.26ed0b53 at uwovax.uwo.ca>, miller at uwovax.uwo.ca (Greg Miller) writes:
> Hi!
> 
> I have been having great problems in setting up an alias within csh.
> 
> I want to test for the presence of a file, and if it exists then
> to execute some statements e.g.
> 
> 
> if ( { test -s /usr/spool/mail/miller } ) then; echo "" ; echo "New mail" ;\
>  echo "" ; endif
> 

Further to my original post, I have since found that the problem is
not associated with the brackets around the expression but is
related to the execution of test.

If the file is present, the condition is met and the statements are
executed.

If the file is zero length, the condition is not true, then
the sequence of commands are not executed but the if statement
is not terminated.

And ideas on why this bizarre behavior and how to get it to
work properly?

J G Miller



More information about the Comp.unix.shell mailing list