Operating System - HP-UX
1834437 Members
2345 Online
110067 Solutions
New Discussion

Re: csh script syntax error

 
SOLVED
Go to solution
Randy_9
Regular Advisor

csh script syntax error

I am having a bit of a problem with the "if"
expression syntax with this "csh" script ( 108 lines ).
To run as is results in "syntax error at line 76; else is not matched"

Sounds pretty self explanitory, but it still eludes me.

Thanks for any help,
Randy
3 REPLIES 3
John Dvorchak
Honored Contributor
Solution

Re: csh script syntax error

Let me take a shot at this the first if statement:

if ($CLEANOPT == "UA") then \

has an ending else on about line 59 I thin:

else if ($CLEANOPT == "KES") then
echo "Cleaning up KES ATTRLIB directory."

but then on line 76 you have another else without an "if".

No big deal but you have to clean up your logic a little. Maybe with an 'if' before the first 'if' mentioned above if you are trying to nest the if-else statement.

Good luck

If it has wheels or a skirt, you can't afford it.
Sridhar Bhaskarla
Honored Contributor

Re: csh script syntax error

Hi Randy,

I observed couple of errors. For ex.,

if ($filelist != "") then
rm `ls ???ATR?? | grep -v ^K`
#endif # Take this out

else if ($CLEANOPT == "KES") then
echo "Cleaning up KES ATTRLIB directory."

In the above else would become unmatched as you closed your previous if.

set filelist = `ls ???CAT?? | grep -v ^K`
if ($filelist != "") then
rm `ls ???CAT?? | grep -v ^K`
endif
endif #<< this matches your above else.

else
goto banner

endif


I don't know the logic but you may have to adjust your endif's to fit to your logic.

-Sri
You may be disappointed if you fail, but you are doomed if you don't try
Randy_9
Regular Advisor

Re: csh script syntax error

John/Sridhar,

Thank you both for your input, I will go
over it using your input ( disclaimer: not my script ). Points assigned. Have a great weekend!
Randy