Bash - round floating point numbers with bash script
Posted on February 21st, 2008 by linux
There is a simple trick how to round floating point numbers within bash script. I’m sure that there are other ways how to round floating point number in bash, if you know other way let me know :
#!/bin/bash
# obtain floating point number
floating_point_number=`echo “2153.6 * 0.98″ | bc`
echo $floating_point_number
# get rounded number
for rounded_number in $(printf %.0f [...]
Filed under: Administration, Bash, Linux, Scripting | No Comments »