Link to home
Start Free TrialLog in
Avatar of mmartha
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 :)
ASKER CERTIFIED SOLUTION
Avatar of blkline
blkline

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Avatar of Tintin
Tintin

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of mmartha
mmartha

ASKER

thank you both. :)