I am a little confused about Bash test expression and if test commands:
(1)
#!/bin/bash
count=90
if [ $((count)) ]; then
echo "True "
else
echo "False"
fi
Executing it:
# ./test1.sh
True
(2)
#!/bin/bash
count=90
if $((count)); then
echo "True "
else
echo "False"
fi
Executing it:
# ./test2.sh
./test2.sh: line 5: 90: command not found
False
(3)
#!/bin/bash
count=90
if ((count)); then
echo "True "
else
echo "False"
fi
Executing it:
# ./test3.sh
True
My questions are as follows:
a) For test2.sh, why does it complain "command not found"?
b) Although test1.sh and test3.sh outputs the same result, do they have same meanings in if condition?