var="pattern to find"
string="Full string where the pattern to find is."
echo "$string" | grep "$var"
rc=$?
if [[ $rc = 0 ]];then
echo "I found $var in $string"
fi
var="pattern to find"
string="Full string where the pattern to find is."
echo "$string" | grep "$var"
rc=$?
if [[ $rc = 0 ]];then
echo "I found $var in $string"
fi
I'm a freelance UNIX engineer working in the UK. I'm married to Tina and between us we have six children. I'm a bit of an Apple fan boy, and all the Windows machines in the house are a thing of the past now.