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

前端 未结 29 1675
慢半拍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:20

    For old version/busybox sort. Simple form provide roughly result and often works.

    sort -n
    

    This is escpecial useful on version which contains alpha symbols like

    10.c.3
    10.a.4
    2.b.5
    

提交回复
热议问题