标签:print done mem bash pre shell bsp gre ps aux
1 #!/bin/bash 2 #方法一: 3 ps aux | grep -v ‘RSS TTY‘ |awk ‘{(sum=sum+$6)};END{print sum}‘ 4 #方法二: 5 sum=0 6 for mem in `ps aux |awk ‘{print $6}‘ |grep -v ‘RSS‘ ` 7 do 8 sum=$[$sum+$mem] 9 done 10 echo "The total memory is $sum""k"
标签:print done mem bash pre shell bsp gre ps aux
原文地址:https://www.cnblogs.com/zhj5551/p/11198237.html