How to compare two strings in dot separated version format in Bash?

前端 未结 29 1729
慢半拍i
慢半拍i 2020-11-22 06:52

Is there any way to compare such strings on bash, e.g.: 2.4.5 and 2.8 and 2.4.5.1?

29条回答
  •  庸人自扰
    2020-11-22 07:06

    There probably is no universally correct way to achieve this. If you are trying to compare versions in the Debian package system try dpkg --compare-versions .

提交回复
热议问题