I have a string in Bash:
string=\"My string\"
How can I test if it contains another string?
if [ $string ?? \'foo\' ]; then
The generic needle haystack example is following with variables
#!/bin/bash needle="a_needle" haystack="a_needle another_needle a_third_needle" if [[ $haystack == *"$needle"* ]]; then echo "needle found" else echo "needle NOT found" fi