You are viewing a single comment's thread. Return to all comments →
Shane, you are right in general, but there's exceptions to your sentence.
Firstly, In test comparisson, it's better use double square brackets rather than one: if [[ $a -ne "0" ]] fi
more info: conditional expression
Secondly, you also can compare integers using == like in this example:
Note that in Bash you don't need the arithmetic expansion to check for the boolean value of an arithmetic expression. This can be done using the arithmetic evaluation compound command:
printf %s 'Enter a number: ' >&2
read -r number
if ((number == 1234)); then
echo 'Good guess'
echo 'Haha... :-P'
more info: Arithmetic expansion
But at the end of the day is up to the programmer to use this functionality or not.