How to compare two version numbers in a shell script

Posted by xmodulo on Mar 17, 2016 11:16 PM EDT
Xmodulo; By Dan Nanni
Mail this story
Print this story

When you are writing a shell script, there are cases where you need to compare two version numbers, and proceed differently depending on whether one version number is higher/lower than the other. For example, you want to check for the minimum version requirement (i.e., $version ? 1.3.0). Or you want to write a conditional statement where the condition is defined by a specific range of version numbers (e.g., 1.0.0 ? $version ? 2.3.1).

Full Story

  Nav
» Read more about: Story Type: Tutorial; Groups: Debian, Fedora, Linux, Ubuntu

« Return to the newswire homepage

This topic does not have any threads posted yet!

You cannot post until you login.