See the UNIX Programmers Manual or via % man csh
% if !(-e filename) echo nope
will test whether filename exists; if not, writes 'nope' to the standard
output, otherwise is silent.
The following file inquiries are available:
-r read access
-w write access
-x execute access
-e existence
-o ownership
-z zero size
-f plain file
-d directory
If the file does not exist or is inaccessible then all enquiries return
false, i.e. '0'.
Command executions succeed, returning true, i.e. '1', if the command exits
with status 0, otherwise they fail, returning false, i.e. '0'.
WARNING:
In csh scripts, the if statement REQUIRES a space character following it.
The following IS WRONG:
if($#argv == 2) then ... endif
and SHOULD BE:
if ($#argv == 2) then ... endif
If your endifs are not working correctly, this could be your problem!