In Bash, you can do numeric comparisons with the familiar operators if you use arithmetic evaluation:
if ((num1 ==num2 ))
if ((num1<0)) # in this context, < is not evaluated as a redirection operator
else if (( $num2 < 0 ))
As you can see, I've been fairly free with my use of spaces and can omit the dollar sign if I want. You should be aware of this, however:
a= # set to nothing, thus null
if (( a == 0 )); then echo "ok"; fi # echoes "ok" since a evaluates to 0
if (( $a == 0 )); then echo "ok"; fi # produces an error even if $a is quoted
String comparisons can be performed with "<" and ">" instead of "-lt" and "-gt" if you use double square brackets. The requirement for spaces is the same with them as it is for single square brackets.
s="b"
if [[ "$s" > "a" ]]
t= # null
if [[ $t < "a" ]] # evaluates to true
As you can see in the last example, when using double square brackets, it's not necessary to quote variables to protect against the possibility of them being null or unset, unlike when using single square brackets.