Operating System - HP-UX
1832694 Members
2720 Online
110043 Solutions
New Discussion

Assistance with a csh if statement

 
SOLVED
Go to solution
Vinesh Dhevcharran
Occasional Advisor

Assistance with a csh if statement

Hello,

I am a beginner with shell programming. I am trying to write a simple if statement on a HP L2000 running HP-UX B.11.00

#!/bin/csh

if ( usm01 = usm01 ) then
echo "equal"
else
echo "not equal"
endif

When I run this I get the following message
" if: Expression syntax. "

What am I doing wrong? Any assistance is greatly appreciated.

2 REPLIES 2
Paula J Frazer-Campbell
Honored Contributor

Re: Assistance with a csh if statement

Hi

if [[ usm01 != usm01 ]] then

The != equate to "not equal to"

Should do it.


Paula

If you can spell SysAdmin then you is one - anon
Robin Wakefield
Honored Contributor
Solution

Re: Assistance with a csh if statement

Hi Vinesh,

You need == instead of =

Rgds, Robin