Читаем The Debian Administrator's Handbook полностью

  modifications. Historically, this browser was previously known as

  Firebird and Phoenix.

GOING FURTHER Comparison of versions

Since dpkg is the program for handling Debian packages, it also provides the reference implementation of the logic of comparing version numbers. This is why it has a --compare-versions option, usable by external programs (especially configuration scripts executed by dpkg itself). This option requires three parameters: a version number, a comparison operator, and a second version number. The different possible operators are lt (strictly less than), le (less than or equal to), eq (equal), ne (not equal), ge (greater than or equal to), and gt (strictly greater than). If the comparison is correct, dpkg gives the return code, 0 (success); if not, it gives a non-zero return value (indicating failure).

dpkg --compare-versions 1.2-3 gt 1.1-4

echo $?

0

dpkg --compare-versions 1.2-3 lt 1.1-4

echo $?

1

dpkg --compare-versions 2.6.0pre3-1 lt 2.6.0-1

echo $?

1

Перейти на страницу:

Похожие книги