Patch-ID: bash32-044
[bash.git] / examples / scripts.v2 / pmtop
blobcc419ac0772be4317900ab42bae4679f5656c9d0
1 #! /bin/bash
3 # pmtop - poor man's `top' for SunOS 4.x
6 CLEAR=clear # could also be 'tput clear'
7 HEADER="USER PID %CPU %MEM SZ RSS TT STAT START TIME COMMAND"
9 if [ -n "$LINES" ]; then
10 SS=$(( $LINES - 2 ))
11 else
12 SS=20
15 while :
17 $CLEAR
18 echo "$HEADER"
19 ps -aux | sort -nr -k 3 | sed ${SS}q
20 sleep 5
21 done
23 exit 0