0

Zsh has the very handy is-at-least utility.

is-at-least 5.7 && echo "You're using a version of Zsh above 5.7" || echo "You're running an old Zshell version.  Upgrade, dude."

How can this be done in Bash? (It must be in a simple way that takes into account that version numbers can have 2 "decimal" points, and that 1.25 is higher than 1.3, unlike with decimal notation for normal numbers.)

iconoclast
  • 21,213
  • 15
  • 102
  • 138
  • You want to compare 1.25 against 3 or 5.7 against something else? It is not clear – Inian Nov 25 '21 at 04:17
  • @David I guess OP is looking to compare versions of Bash and not just get it – Inian Nov 25 '21 at 04:22
  • If the linked question does not provide a solution, drop a comment and I'm happy to reopen -- but there are eight very good answers there. – David C. Rankin Nov 25 '21 at 04:23
  • @Inian - yes, I checked, the answers in the linked question *compare* against a target version after getting the current version. The answer by FelixEnescu looks quite good. – David C. Rankin Nov 25 '21 at 04:24

0 Answers0