The following code
if [ $a == "apple" ];
then
echo "True"
else
echo "False"
fi
outputs "True"
("False"
) if a="apple"
(a="plum"
). The comparison fails if one uses wildcards:
if [ $a == "appl"* ];
and is fixed if one replaces [
by [[
:
if [[ $a == "appl"* ]];
What is the difference between [
and [[
in if
statements?