[wplug] Bash conditional help

scoob8000 scoob8000 at gmail.com
Fri May 2 14:28:10 EDT 2008


I'm having a little brain fart here..

How can I use an if then else to test for partial matches in a variable?

For example, say I want to match on "apple" below...

myvar=orange orange apple grape

if [ "$myvar" = "apple" ]; then
echo Variable contains apple
else
echo Variable does not contain apple
fi

Thanks
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.wplug.org/pipermail/wplug/attachments/20080502/331f65ce/attachment.html 


More information about the wplug mailing list