Bash script to find out the summary of user memory usage [not working]

Patrick Dung patrick_dkt at
Fri Dec 14 22:37:25 PST 2007

Hello, any idea about why below script is not working?
The final sum is empty..


for user in `ps -A -o user | sort | uniq | tail +2`
        echo "user: $user"

   ps aux -U $user | tail +2 | while read line

    mem=`echo $line | awk {'print $4'}`
        echo "mem: $mem"
        TMPSUMMEM=`awk -v x=$mem -v y=$TMPSUMMEM 'BEGIN{printf
        echo "summem: $TMPSUMMEM"
        echo "finalsummem: $SUMMEM"
 donefreebsd-questions at

Looking for last minute shopping deals?  
Find them fast with Yahoo! Search.

More information about the freebsd-questions mailing list