I’m trying to find a way to round up a few numbers.
The topic I found: https://stackoverflow.com/questions/2395284/round-a-divided-number-in-bash
I am using the following command in my bash script..
free -h | gawk '/Mem:/{print $2}' | awk 'FNR == 1 {print $1 "B"}')
The following code will show me how much in total Memory i have installed. Currently, im getting 3.7GB. The problem is, i need this to be rounded up to 4GB.
I have a script that requests my machine a bunch of info and will echo it all out. (Prolly should use something different but haven't tried anything else yet as this is one of my projects that i am working on.
memory=$(free -h | gawk '/Mem:/{print $2}' | awk 'FNR == 1 {print $1 "B"}')
echo $memory
Right now it echo's out 3.7GB as mentioned below. I'v tried it different ways but can't seem to get it to 4GB.