Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 204
  • Last Modified:

How to test for file existence in C shell script.

What is the syntax for the If statement when testing for the
existence of a file in a C shell script?
e.g. in Korn Shell, if test -f $filename then....
How is this done in C Shell?
0
Beaker040497
Asked:
Beaker040497
1 Solution
 
dominusCommented:
Use

if ({ test -f $filename }) then
   ...
else
   ...
endif

The white space is important here---don't omit the space
after $filename.

0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now