This page is READ-ONLY. It is generated from the old site.
All timestamps are relative to 2013 (when this page is generated).
If you are looking for TeX support, please go to VietTUG.org

Bash: compare two versions

hi, Bash rocks
Added by icy almost 2 years ago  »  Votes: 1/1

How to compare two version strings in Bash !?

My small routine may help: Bash Compare Two Versions. Example:

1 $ __version_compare_v1_le_v2 1.1.1 1.1.2
2 # Return 0 (aka TRUE)
3 $ __version_compare_v1_le_v2 2.1.1-1 1.1.1-2
4 # Return 1 (aka FALSE)
5 $ __version_compare_v1_le_v2 1.1.1 2.2.2.4
6 # Return 2 (aka FAILED to compare two different formats)

Comments