Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!swrinde!zaphod.mps.ohio-state.edu!samsung!uunet!convex!usenet From: tchrist@convex.COM (Tom Christiansen) Newsgroups: comp.unix.questions Subject: Re: The "if ( -e filename )" blues... Message-ID: <1991Jun17.231251.1745@convex.com> Date: 17 Jun 91 23:12:51 GMT References: <1991Jun17.195519.12713@murdoch.acc.Virginia.EDU> Sender: usenet@convex.com (news access account) Reply-To: tchrist@convex.COM (Tom Christiansen) Organization: CONVEX Software Development, Richardson, TX Lines: 41 Nntp-Posting-Host: pixel.convex.com From the keyboard of eas@turing.acs.virginia.edu (Edward A. Schwab): :Help! I'm trying to run a simple csh shell file that sets $OUT.out to an :output filename and $PROG to a program name, will search for $OUT.out, and :delete it... I'm trying to do an "if ( -e $OUT.out ) set x=$<", which will :wait for an ENTER before continuing with the program... The only thing is :that the "if ( -e )" statement (that searches for the existance of the file) :runs if there is an actual $OUT.out file or not... **sigh** How can I make :this wait for an enter keypress ONLY if $OUT.out exists??? All of the other :if -e's work (the echos and the rm...) BTW, the actual executable is called :.$PROG; this is called up by $PROG... :) you need to say if (-e foo) then set x = "$<" endif so it doesn't try to eval the $< even when it doesn't need to. : :I hope this message makes SOME sense when you look at the actual shell script :below: :----------------------------------------------------------------------------- :#!/bin/csh you forgot the -f. :setenv OUT for005 :setenv PROG asymtc1 now you have a WHOLE LOT of -e's. why don't you just do one and make a block and save a lot of stat's, plus the $< headache? there's nothing in this script demanding csh. why don't you do yourself a favor and use sh? it sure beats a boot to the head, which is all csh will ever give you. --tom -- Tom Christiansen tchrist@convex.com convex!tchrist "So much mail, so little time."