方法一: !/bin/bash #方法一: ps -aux |awk '{print$5}' |grep -v 'VSZ' |grep -v '0' > num1.txt #按照要求提取数字到num1.txt中 sum=0 while read i do sum=$[$sum+$i]