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