for svc in a b c d
do
service_status=$(service xy-mp-$svc status)
if echo $service_status | egrep -i 'xy-mp-"$svc" dead but pid file exists|xy-mp-"$svc" is stopped' &> /dev/null
then
service xy-mp-$svc restart
fi
done
With "$svc
",the variable substitution isn't taking place in the egrep.Does anyone have ideas on how I could do the variable substitution in this example?
Appreciate any pointers.