The command [
is just an alias of the command test
, the closing square bracket just being sytax sugar (the command [
ignores the last argument if it's a closing bracket), so the line actually reads
if test :$RESULT != :0,0
It compares if the string :$RESULT
equals to the string :0,0
. The colon is prepended for the case that the variable $RESULT
is empty. The line would look like the following if the colon was omitted and $RESULT
was an empty string:
if test != 0,0
This would lead to an error, since test
expects an argument before !=
. An alternative would be to use quotes to indicate that there is an argument, which is an empty string:
if test "$RESULT" != 0,0
# Will become
if test "" != 0,0
The variation you posted is more portable, though.