In the following example, I find that the if [ $aaa==x ]
condition is always true.
for aaa in {x,y}
do
echo ---------
echo $aaa;
if [ $aaa==x ]
then echo this is x
elif [ $aaa==y ]
then echo this is y
fi
echo $aaa;
done;
That is, I always get the output as:
---------
x
this is x
x
---------
y
this is x
y
Even if I replace ==
with =
, the problem remains. Why?