on-prem/jidoteki-admin

Sorting command fails on v >= 10

Closed this issue · 1 comments

aw commented

The sorting command used to identify the latest software update package will fail if the version number is greater or equal to 10.

Example output :

$ ls -r software_package-*.asc*
software_package-v1.1.7.asc
software_package-v1.10.9.asc
software_package-v1.10.7.asc
software_package-v1.0.5.asc
software_package-v1.0.1.asc

The latest should be v1.10.9.

This can be fixed with sort --version-sort -r

Example:

$ ls software_package-*.asc* | sort --version-sort -r
software_package-v1.10.9.asc
software_package-v1.10.7.asc
software_package-v1.1.7.asc
software_package-v1.0.5.asc
software_package-v1.0.1.asc
aw commented

Note: This sort command requires GNU sort from coreutils.