for i in `seq 1 100` ;do echo $i>>a.log;done echo `cat a.log|tr "\n" "+"|sed 's/100+/100/g'`|bc
while讀文件的方式shell
法一:code
exec<file while read line do cmd done
法二:cmd
cat ${file_path}|while read line do cmd done
法三:class
while read line do cmd done<file