Results 1 to 2 of 2
Hi all,
I have the same problem. I'm doing a script to validate the Operating System RHEL. If the release is less than version 6 send me and message
function ...
- 07-29-2011 #1Just Joined!
- Join Date
- Jul 2011
- Posts
- 1
Decimals issue using bash script
Hi all,
I have the same problem. I'm doing a script to validate the Operating System RHEL. If the release is less than version 6 send me and message
function release {
rel=`cat /etc/redhat-release | grep "release" | awk '{print $7}'`
if [ $rel -lt 6 ] ; then
echo "less than 6"
else
echo "more than 6"
}
I know "-lt" is for interger numbers, i don't know how to do the condition with floating numbers... because the release is 5.5 & send me the error "syntax error: invalid arithmetic operator (error token is ".5")"
Someone can helpme with that issue, please ??
Thanks
- 07-31-2011 #2Linux Guru
- Join Date
- May 2011
- Posts
- 1,842
There's about a million ways to do this...here's one: Strip off the dot and everything after it w/sed:
Code:rel=`cat /etc/redhat-release | grep "release" | awk '{print $7}'|sed -e 's|\..*$||'`


Reply With Quote