I want to compute an average with 3 decimal figures, rounded to nearest, using bc.
bc
For example:
average of 3, 3 and 5 should yiel
This solution is not that flexibile (it just converts float to int), but it can deal with negative numbers:
e=$( echo "scale=0; (${e}+0.5)/1" | bc -l ) if [[ "${e}" -lt 0 ]] ; then e=$(( e - 1 )) fi