| rounding numbers in bash I need to be able to round numbers in bash to the nearest whole number. So for example the number 4.678923 would round up to 5. I tried to use the cut command and delimit by a '.' but that won't work because it will take the whole thing after the decimal point as one big number so the number 2.18745 would get rounded up when it should get rounded down because it takes 1875 as the number and compares it to see if its greater than 5 which it is so then it rounds up. I need a way to just get the first number after the decimal point. I tried the -c command but that takes characters then when i go into the if statement to compare it to 5 it says it needs an integer. Any ideas? |