Reliable sorting of version strings?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



What is the proper way of comparing versions of rpms in a bash script?

This is actually two questions, what is the proper order, and what is
the simplest way of implementing that order.

To the first part, is this right? 
  4.01-3
  4.01-3p  # letter suffixes sort like strings
  4.01-3q  
  4.1-3p   # leading zeros before no leading zero
  4.2
  4.10     # otherwise numeric part sort as numbers
  4.10-4
  4.10.3-1 # components separated with dots are "more important" than
the dash, i.e. 4.10-4 is a "smaller variation" of 4.10 than 4.10.3

I think I have seen versions with letter prefixes too. How do they sort?

( <rant> 
   And why the heck do people invent such versions strings!!
  </rant> )

Regards,
Enrique



_______________________________________________
Rpm-list mailing list
Rpm-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/rpm-list

[Index of Archives]     [RPM Ecosystem]     [Linux Kernel]     [Red Hat Install]     [PAM]     [Red Hat Watch]     [Red Hat Development]     [Red Hat]     [Gimp]     [Yosemite News]     [IETF Discussion]

  Powered by Linux