I can get the 5.8 or 6.4 number from looking at /etc/redhat-release
, but I don't know how to get it converted from 5.8
to just 5
. The command I'm using so far is:
cat /etc/redhat-release | awk {'print $7'}
Which produces the 5.8
. How would I go about getting the single digit integer from that using bash?
Or use int()
function:
cat /etc/redhat-release | awk '{print int($7)}'
$ cat /etc/redhat-release | awk {'print $7'}
5.8
$ cat /etc/redhat-release | awk '{print int($7)}'
5
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With