views:

29

answers:

1

I am having trouble writing a simple if statement in a BMC Bladelogic NSH shell script.

My question is what is the proper syntax to write a statement that compares two strings to see if they are equal or not. I understand how an if statement works the problem seems to be syntax.

An example of what I have tried is as follows where $PLATFORM is a string represintation of the server such as "aix" and $AIX is "aix"

if [ $PLATFORM == $AIX ];then 
 #do stuff
else
 #do other stuff
fi

This is a very specific question for if you deal with BMC Bladelogic NSH

A: 

Actually I feel foolish the answer is actually as such:

if [ $PLATFORM = $AIX ];then  
 #do stuff 
else 
 #do other stuff 
fi 

I knew it would be something very simple.

tuckster