On Sun, May 13, 2007 at 08:19:13AM -0600, Eric Blake wrote:
[...]
> if [[ 1 > 2 ]]
> 
> > This should be a string compare.
> 
> Actually, when quoted properly, it should be a numeric comparison, not a
> string comparison.
[...]

It *is* a string comparison:

$ bash -c '[[ 02 > 1 ]]' || echo "02 is not greater than 1"
02 is not greater than 1

[[ a > b ]], [ a '>' b ] are string comparisons.

[ a -gt b ], [[ a -gt b ]], (( a > b )) are numeric comparisons.

expr's > is both depending on whether the operands are
recognised as integers or not.

in awk, it depends on the type of the arguments.

-- 
Stéphane


_______________________________________________
Bug-bash mailing list
Bug-bash@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-bash

Reply via email to