On 07/06/11 09:03, Chet Ramey wrote:
/usr/bin/test ?

Do this first in the binary then migrate to bash's test?

I was actually making an argument for an entirely separate utility to do
this.  That could be a shell script encapsulating the proper version
comparison logic.

which basically means a script wrapping "sort -V" and testing whether
the arguments got reordered or not:

  if test "X$1" = "X$3"
  then is_eq=true ; is_lt=false
  else
    is_eq=false
    first=$(printf '%s\n%s\n' "$1" "$2" | sort -V | head -1)
    test "X$first" = "X$1" && is_lt=true || is_lt=false
  fi

and if that proved insufficient, then "sort -V" would need an adjustment.
I would not expect "sort -V" and a version test to disagree.

Reply via email to