List:General Discussion« Previous MessageNext Message »
From:tony.chamberlain Date:January 14 2010 3:21pm
Subject:version
View as plain text  
I have an install script that does some stuff with mysql (i.e. install,
start, etc).  It installs
mysql  Ver 14.12 Distrib 5.0.19, for pc-linux-gnu (i686) using readline 5.0

This was good when we just used CentOS 4.5.  Now we are doing some later
CentOS versions and the mysql version may be higher.

I want to do something like  "mysql --version" and process the result and
if the version is >= 5.0.19 skip the mysql installation and just do the
other stuff.  I can't compare as it is right now because the . and stuff
may screw up the comparison (e.g. ver 5.2 will show as greater than 5.19
eg).

I want to know, if I break the individual pieces like 14 12 5 0 19 I can do
some sort of calculation to determine a number that I can actually compare.
Or can I just remove all the decimal points, like 14.12.5.0.19 becomes
14125019?  I might have to make it like  14120050019 or something.

What is an algorithm I can use?


Thanks


Thread
versiontony.chamberlain14 Jan
  • Re: versionJohan De Meersman14 Jan
Re: versiontony.chamberlain14 Jan
  • Re: versionJohan De Meersman14 Jan