I am having trouble comparing integers with decimals in bash if/then statement. I am writing a short script that checks the linux version on a system and if it below 7.9 it will create an alert. I have tried changing the comparing operator to something that works. (-lt/-gt, </>, /< />)
#!/bin/bash
linux_version=$(sudo cat /etc/centos-release | cut -b 22-24)
if [ $linux_version -lt 7.9 ]
echo 'This server needs to be updated to 7.9 Current Version: '$linux_version
then
exit 1
else
echo 'This server is updated'
exit 0
fi