Practice Exercise in Bash Basics Series #7: If Else Statements

If you are following the Bash Basics series on It’s FOSS, you can submit and discuss the answers to the exercise at the end of the chapter:

Fellow experienced members are encouraged to provide their feedback to new members.

Do note that there could be more than one answer to a given problem.

#!/bin/bash

if [[ ${1//$2} != $1 ]]; then
echo “substring is there”
else
echo “No substring”
fi
~
~

Welcome to the Community @vinukrishna1312

Could you please explain what you are trying to do for the substring check?

1 Like