A for loop in an if statement tcsh
I have a program that runs the following commmands
if (-e ${CALIBPLOTS}/y*.eps) then
foreach file ($CALIBPLOTS/y*.eps)
set jpgfile = `echo $file | sed s/\.eps//g`
convert $file ${jpgfile}.jpg
end
endif
The problem I have is that with that foreach loop, if no files exist the program outputs that no file exists and stops running. So I wanted to put that if statement there so that it only runs if there is a file. But for some reason if there isn't a file it still runs the foreach loop and stops running.
Everything works fine if there is a file there.
Any ideas how I can get this to run properly
|