mmartha
asked on
bash scripting - search a match in a string
I have a string on a variable, I want to search for two matches.. something like this:
var="Take the red pill, or the blue pill"
if [ "red pill" isin $var ]; <-- this I don't know
then
echo "Somebody mentioned the red pill"
else
echo "Somebody said something but not about the red pill"
fi
I googled for "search string" and stuff but I get awk and expr funtions that I don't seem to understand (or indeed it isn't me and the result of my search aren't right). Maybe I'm looking wrong. :S
Thaaanks experts :)
var="Take the red pill, or the blue pill"
if [ "red pill" isin $var ]; <-- this I don't know
then
echo "Somebody mentioned the red pill"
else
echo "Somebody said something but not about the red pill"
fi
I googled for "search string" and stuff but I get awk and expr funtions that I don't seem to understand (or indeed it isn't me and the result of my search aren't right). Maybe I'm looking wrong. :S
Thaaanks experts :)
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER