#!/bin/rc # top rfork en flagfmt='d interval,m maxlines' args='' old=/tmp/top.$pid.old new=/tmp/top.$pid.new out=/tmp/top.$pid.out int=2 max=20 len=() fn usage{ aux/usage exit usage } fn isfloat{ echo $1 | grep -s '^[0-9\.]+$' } fn isnum{ echo $1 | grep -s '^[0-9]+$' } fn get{ grep . */status | sed ' s!/status:! ! s! +! !g ' } fn clear{ awk 'END { for(i = 0; i < '$len'; i++) printf "\x08" }' $old sleep $int while(){ { echo echo top: top } >$out if(~ $#len 1) clear len=`{wc -r <$out} cat $out sleep $int }