Dear all,
What is wrong with my if condition, it never enters the if:
#!/bin/bash
echo "Enter integers, enter -1 to stop."
declare -a FOO
for((i=0;;i++)); do
read FOO[i]
if [ "[$FOO[i]" == -1] ]; then #Never enters here
echo "inside"
break
fi
done
foonum=${#FOO}
for ((i=0;i<$foonum;i++)); do
echo ${FOO[${i}]}
done
By the way, if you see any other syntax or logical error, please let me know.
Thank you.