string='Haystack'; if [[ $string =~ "Needle" ]] then echo "It's there!" fi
#!/bin/bash STR='GNU/Linux is an operating system' SUB='Linux' if grep -q "$SUB" <<< "$STR"; then echo "It's there" fi
#!/bin/bash STR='GNU/Linux is an operating system' SUB='Linux' if [[ "$STR" == *"$SUB"* ]]; then echo "It's there." fi
#!/bin/bash STR='GNU/Linux is an operating system' SUB='Linux' if [[ "$STR" =~ .*"$SUB".* ]]; then echo "It's there." fi
#!/bin/bash STR='GNU/Linux is an operating system' SUB='Linux' case $STR in *"$SUB"*) echo -n "It's there." ;; esac