trap 'echo "$CN\c";trap 0;exit' 0 2 3 15         trap 'trap 0;exit' 1         N=`tput lines`         EL=`tput el` ED=`tput ed` CL=`tput clear` HO=`tput home`         CF=`tput civis` CN=`tput cnorm` F="%12.2f%3d$ED$HO"         echo "$CF$CL\c"         HDR="`ps -p1 -opid -opcpu -oc -oargs | head -1`"         while :         do           ps -e -opid= -opcpu= -oc= -oargs= |           sort -rn +1 |           awk -v H="$HDR" -v N="$N" -v E="$EL" -v F="$F" '             BEGIN{print H;N-=2}             $2>0||$3{print substr($0,1,79) E;P+=$2;C+=$3}             NR>=N{exit}             END{printf F,P,C}'           sleep ${1-1}  # sleep time on script's command line (default 1 sec.)         done 
(本文已被浏览 2455 次)
|
|