PIDPATH=/proc/ TOTLE=0 cd $PIDPATH DOC=`ls` for DOCNAME in $DOC do if [ -d $DOCNAME ]; then cd $DOCNAME if [ -f status ];then MEMERY=`grep VmRSS status | awk -F':' '{print $2}' | awk '{print $1}'` PIDNAME=`grep Name status | awk -F':' '{print $2}'` if [ $MEMERY ]; then echo -n $PIDNAME >> /root/script/pid.f echo -n " " >> /root/script/pid.f echo $MEMERY >> /root/script/pid.f TOTLE=`expr $TOTLE + $MEMERY` cd .. else cd .. fi else cd .. fi fi done TOTLE=`expr $TOTLE / 1024` echo "TOTLE USERD: $TOTLE MB" >> /root/script/pid.f cat /root/script/pid.f