C shell Program

Hellow every body
I am trying to write a very simple script in an executable file as following

if ($?PWD) then
echo "OK"
else
echo "No"
endif

but I am getting error during execution in c shell as
synthax error at line 4 , unexpected end of file

Please advise

I was searching for an answer and came across an interesting article .. I'd say you might want to learn a different scripting language, as CSH seems to be quite limited:

http://www.cs.uu.nl/wais/html/na-dir/unix-faq/shell/csh-whynot.html

I'm not sure why that code won't execute though...

Is that the whole script?

Most of the time you should specify #!/bin/csh at the begining to insure it is using csh.

See this thread