bash message partial match code example
Example 1: bash message partial match
if [[ $string == *"foo"* ]]; then
echo "It's there!"
fi
Example 2: substring if statement variable shell script
string="My string"
Example 3: substring if statement variable shell script
if [ $string ?? 'foo' ]; then
echo "It's there!"
fi