While reading through a bash style guide I found the following guideline:
Math / Integer Manipulation
Use
((...))and$((...)).
a=5
b=4
wrong
if [[ $a -gt $b ]]; then
...
fi
right
if ((a > b)); then
...
fi
When I inquired about the reasoning I was told that the [[ test could potentially choke trying to compare numbers with leading zeros. In my testing I have not been able to recreate this issue.
My Question
Is there actually a functional difference between
((a > b))and[[ "$a" -gt "$b" ]]?