bash if variable contains word code example
Example 1: substring if statement variable shell script
string="My string"
Example 2: bash substring test
#!/bin/bash
STR='GNU/Linux is an operating system'
SUB='Linux'
case $STR in
*"$SUB"*)
echo -n "It's there."
;;
esac