substring if statement variable shell script

C++
#!/bin/bash

STR='GNU/Linux is an operating system'
SUB='Linux'
if [[ "$STR" == *"$SUB"* ]]; then
  echo "It's there."
fi
if echo "$string" | grep 'foo'; then
  echo "It's there!"
fi
string="My string"
#!/bin/bash

STR='GNU/Linux is an operating system'
SUB='Linux'

case $STR in

  *"$SUB"*)
    echo -n "It's there."
    ;;
esac
if [ $string ?? 'foo' ]; then
  echo "It's there!"
fi

Source

Also in C++: