2012-08-17

How to check if a variable contains a string

string="this string contains a test substring"

if [[ "$string" == *test* ]]
then
        print "substring found"
fi 
 

No comments:

Post a Comment