Reputation: 209
let's assign like this:
a=7
b=29
[[ $a < $b ]] && echo dasf
it doesn't work!!
however, when
a=1
with b and command same, it works well.
That's very funky! Can somebody explain that?
Upvotes: 1
Views: 66
Reputation: 48310
You're comparing the variables lexically, not numerically.
Try
[[ $a -lt $b ]] && echo smaller
or
(( $a < $b )) && echo smaller
Upvotes: 3