check string includes string bash 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