You *should* be using a package manager (perfectly fine RPMs available for
all your needs), but if you must do this, it's a reasonably safe bet to
right-align and zero-pad all your number to 4 digits, at which point you're
free to concatenate them and treat them as a single number.

14.12.5.0.19 then becomes 0014 0012 0005 0000 0019 which becomes
140012000500000019.

You'd probably be safe with 3 or maaaaaaaybe even two positions, depending
on how many releases get done :-)

The better-but-more-work way is to compare every number separately, starting
with the major release.


On Thu, Jan 14, 2010 at 4:21 PM, <tony.chamberl...@lemko.com> wrote:

> 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
>
>
>
> --
> MySQL General Mailing List
> For list archives: http://lists.mysql.com/mysql
> To unsubscribe:    http://lists.mysql.com/mysql?unsub=vegiv...@tuxera.be
>
>


-- 
Bier met grenadyn
Is als mosterd by den wyn
Sy die't drinkt, is eene kwezel
Hy die't drinkt, is ras een ezel

Reply via email to