xxxxxxxxxx
if [ "$variable1" = "$variable2" ]; then
# Code to be executed if the condition is true
echo "Variables are equal."
else
# Code to be executed if the condition is false
echo "Variables are not equal."
fi
xxxxxxxxxx
Use == operator with bash if statement to check if two strings are equal.
You can also use != to check if two string are not equal.
You must use single space before and after the == and != operators.