diff options
Diffstat (limited to 'tests/vercmp.sh')
-rw-r--r-- | tests/vercmp.sh | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/tests/vercmp.sh b/tests/vercmp.sh new file mode 100644 index 0000000000..8310c01d47 --- /dev/null +++ b/tests/vercmp.sh @@ -0,0 +1,31 @@ +# Commandline-driver tester for version comparison shell functions +# +############################################################################### +# +# Copyright (C) 2013 Red Hat, Inc. All Rights Reserved. +# Written by David Howells (dhowells@redhat.com) +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License +# as published by the Free Software Foundation; either version +# 2 of the License, or (at your option) any later version. +# +############################################################################### + +. ./version.inc.sh + +# +# Compare versions +# +if [ "$1" = "" -o "$2" = "" ] +then + echo "Missing version parameters" >&2 + exit 2 +fi + +if version_less_than $1 $2 +then + echo "$1 < $2" +else + echo "$1 >= $2" +fi |