This will be a common use case when we need to check some substring in a log or some file. You can achieved by using the below scripts. In the below we need to search the keyword “freshers” in the string given
string='freshers.in/tags/python'
if [[ $string == *"freshers"* ]]; then
echo "Substring found"
else
echo "NOT FOUND"
fi