bash script check if string contains substring code example
Example: checking if a substring exists in a string bash
string='Haystack';
if [[ $string =~ "Needle" ]]
then
echo "It's there!"
fi
string='Haystack';
if [[ $string =~ "Needle" ]]
then
echo "It's there!"
fi