kibi@armor:~$ a=1.0; for b in 0.9 1.0 1.1; do dpkg --compare-versions $a '<<' $b; echo $?; done
1
1
0
kibi@armor:~$ a=1.0; for b in 0.9 1.0 1.1; do dpkg --compare-versions $a '<=' $b; echo $?; done
1
0
0
Extrait de la page de manuel :
--compare-versions ver1 op ver2
Compare version numbers, where op is a binary operator. dpkg
returns true (0) if the specified condition is satisfied, and
false (1) otherwise. There are two groups of operators, which
differ in how they treat an empty ver1 or ver2. These treat an
empty version as earlier than any version: lt le eq ne ge gt.
These treat an empty version as later than any version: lt-nl
le-nl ge-nl gt-nl. These are provided only for compatibility
with control file syntax: < << <= = >= >> >. The < and >
operators are obsolete and should not be used, due to confusing
semantics. To illustrate: 0.1 < 0.1 evaluates to true.
# dpkg --compare-versions
Posté par Cyril Brulebois (site web personnel) . En réponse au message Outil en ligne de commande pour comparer des versions de logiciels. Évalué à 7.
Exemples :
Extrait de la page de manuel :
Debian Consultant @ DEBAMAX