I wrote a wrapper for rpmbuild that creates the source.tgz file in the ~/rpmbuild/SOURCES/
. However when I use this script on an older operating system; rpm's are built in /usr/src/...
. So inside my bash script I would like to get the version number of rpmbuild; like this for example:
rpmbuild --version
which gives: RPM version 4.11.1
. I'll get that into a variable; lets say
VERSION=4.11.1
Now how can I check easily inside my script that this is a version >=4.6.0 ? Do I really need to start parsing it into major, minor and bugfix and compare the three numbers, or is there another better way to do this? something like:
if [[ $VERSION >= 4.6.0 ]]
then
# do stuff...
fi