Pattern: Missing use of []
to compare values
Issue: -
If this was supposed to be a comparison, use square brackets: [ "$var" = value ]
If this was supposed to be an assignment, remove spaces around =
: var=value
.
Example of incorrect code:
# Assignment
var = value
# Comparison
if $var = value
then
echo "Match"
fi
Example of correct code:
# Assignment
var=value
# Comparison
if [ "$var" = value ]
then
echo "Match"
fi