If condition

hi
what is different between two code below?
what is the role of "./"?

if ( -e wind ) then
if ( -e ./wind ) then

many thanks
samad

Please post (at least) OS and shell versions in every new thread that you create, so to avoid ambiguities and keep people from guessing. In above case, also the language / compiler that the construct is used for / with.

my os is centos and shell is csh
above command like "if ( -e ./wind ) then" is in the shell script not language program.

thanks

Please be aware that csh is not well represented nor received (for good reasons) in these forums. Even I had to search this forum's man pages. Would be worthwhile reading for you as well.

./wind explicitly denotes the current working directory to search for file "wind" whereas wind searches in the current working directory (pointed to by $PWD ).

We agree so far.

you probably meant "searches along the PATH variable", no? In both cases, if found, the executable wind is run and the shell exits (or not exits) depending on the return code of this program.

And, yes, the best thing one can do with the csh is to forget it ever existed.

I hope this helps.

bakunin

1 Like

I'm afraid I hastily quoted the wrong part of the man page. I meant to copy this

. I corrected my above post. Thanks bakunin for pointing this out.