Following codes
echo 'input text : '
read -a names
for((i=0;i<${#names[@]};i++))
do
name="${names[$i]}"
echo "given input is"
echo ${name}
test="test1"
color="${colors[$i]}"
shape="${shapes[$i]}"
if [ $name=$test ]
then
echo '1'
elif [ $name="test2" ]
then
echo '2'
else
echo '3'
fi
echo "test done"
done
always give 1
✦2 ❯ sh ./test.sh input text : test1 given input is test1 1 test done
contradictory to the expectation. What would be correct syntax?