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.)

4
  • You want to compare 1.25 against 3 or 5.7 against something else? It is not clear Commented Nov 25, 2021 at 4:17
  • @David I guess OP is looking to compare versions of Bash and not just get it Commented Nov 25, 2021 at 4: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. Commented Nov 25, 2021 at 4: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. Commented Nov 25, 2021 at 4:24

0

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.