How to match a exact word in a variable ????

Hi All,

Str="online maintenance"
if [ $str == "online" ] then perform some action

I know the above comparison is wrong ..... Actually I am very new to this solaris..

I want to check for online in a variable and perform some action based on that How can I do it?

which shell are you using bash,ksh ??

ksh shell

if [ "$(echo $Str | grep online)" ]; then
  echo Online
fi

Or:

#!/bin/ksh

Str="online maintenance"

case $Str in
  online*) echo Yes
	;;
  *)	echo No
	;;
esac

bash(newer solaris)

str="online maintenance"
case "$str" in 
  *online* ) echo "Found";;  
esac

Or:

#!/bin/ksh
str="online maintenance"
if [[ "$str" = *online* ]]
then echo Yes
else echo No
fi 

Jean-Pierre.