How can i accomplish number comparison involving negative numbers?
if [[ "-2" > "-1" ]]; then
echo "-2 >-1"
else
echo "-2 <=-1"
fi
I also tried
if [ '-2' -lt '-1' ]; then
but the condition always behaves as if -2 would be greater than -1.
The comparisons work when i do not use negative numbers.
I would like a solution in pure bash if possible.