For checking the existence of any file in csh script I am using
if [ -f /var/opt/temip/conf/.temip_config ]
but I am getting below error
if [ -f /var/opt/temip/conf/.temip_config ]
if: Expression Syntax.
Can anyone tell me how to do this?
From the manpage:
f
Plain file
You use it with a if
statement:
if ( -f file.txt ) then
echo Exists
else
echo No such file
endif
Based on this question and your previous question, you seem to be rather clueless as to how csh
syntax works, since you keep using POSIX shell syntax. I would strongly suggest that you either familiarise yourself with the csh
syntax, or just use a POSIX shell (which is probably better for scripting anyway).