misc sh
1 list=$(ps -eo rss,pid,rss,args | grep -v '\[' | sort -k 1 -r -n | awk '{print $1}') 2 total=0 3 4 for e in $list;do 5 if [ "$e" != "RSS" ];then 6 total=$((total+e)) 7 fi 8 done 9 10 echo $total
1 list=$(ps -eo rss,pid,rss,args | grep -v '\[' | sort -k 1 -r -n | awk '{print $1}') 2 total=0 3 4 for e in $list;do 5 if [ "$e" != "RSS" ];then 6 total=$((total+e)) 7 fi 8 done 9 10 echo $total