🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.unix.shell
Article #1034

Re: Help needed with conditional statement for alias in csh

#1034
From: Greg Miller
Date: Tue, 11 Sep 1990 21:48
28 lines
1301 bytes
In article <6929.26ed0b53@uwovax.uwo.ca>, miller@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
Technical Details
Message-ID: <6932.26ed237f@uwovax.uwo.ca>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!watserv1!ria!uwovax!miller
References: <6929.26ed0b53@uwovax.uwo.ca>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!watserv1!ria!uwovax!miller
From: miller@uwovax.uwo.ca (Greg Miller)
Newsgroups: comp.unix.shell
Subject: Re: Help needed with conditional statement for alias in csh
Message-ID: <6932.26ed237f@uwovax.uwo.ca>
Date: 11 Sep 90 21:48:47 GMT
References: <6929.26ed0b53@uwovax.uwo.ca>
Followup-To: j g miller <miller@ria.ccs.uwo.ca>
Organization: University of Western Ontario, LONDON, ON
Lines: 28