标签:循环 awk bin mem 统计 done ps aux bash 内存
1 #!/bin/bash
2 SumMem=0
3 for i in `ps aux | awk ‘{print $6}‘ | grep -v "RSS"`;do #循环ps aux列出的所有列的次数
4 SumMem=$(($SumMem+$i))
5 done
6 SumMem=$(($SumMem/1024)) #将单位以M显示
7 echo "The all SumMem are ${SumMem}M"
~
标签:循环 awk bin mem 统计 done ps aux bash 内存
原文地址:https://blog.51cto.com/11342825/2430286