前提是,文件中只有一列数字。计算脚本为:
let sum=0 ; for i in `cat file `; do let j=$i; let sum=$j+$sum; done; echo $sum
let sum=0 ; for i in `cat file `; do let j=$i; let sum=$j+$sum; done; echo $sum
编辑回复