This question already has an answer here:
bash and some other interpreters only perform arithmetic for integers. In the following
for loop, how can I accomplish this? I've read that
bc can be used but am not sure how to use
bc in this situation.
total=0 for number in `cat /path/to/file`; do total=$(($total+$number)) done average=$(($total/10)) echo Average is $average
1.143362 1.193994 1.210489 1.210540 1.227611 1.243496 1.260872 1.276752 1.294121 1.427371