Need help with IF and Grep

:confused:

I would like to write a script to read this yast2_vhost.conf file.
if the word maintenance exit then end script otherwise continue to
execute a few more commnands.

I have a file call yast2_vhost.conf and it contain multiple entries call
maintenance.html
/srv/www/maintenance/
/srv/www/maintenance/maintenance.html ..etc

Here is what I have and it doesn't work correctly.
How can I perform a grep and it will give me a contain word (maintenance) instead of a string or the whole line of info.

or is there a CONTAIN in IF statement ?

******************************************************
#!/bin/ksh
result=$(grep "maintenance" /etc/apache2/yast2_vhost.conf)

if [[ $result = maintenance ]]; then
echo "you messed up"
else
cp /etc/apache2/orginal.conf /etc/apache2/current.conf
fi

********************************************************

Thanks much,

Y

First of all, grep generally returns the entire line; and you are trying to match an entire line with only a phrase, so you will not match if the line contains more than the phrase.

Neo,

I realize that after try out different things.
Is there a different way to achieve what I need?

Thanks,
Y