repo.or.cz
/
bash.git
/
blob
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
log
|
graphiclog1
|
graphiclog2
|
commit
|
commitdiff
|
tree
|
refs
|
edit
|
fork
blame
|
history
|
raw
|
HEAD
Patch-ID: bash32-044
[bash.git]
/
examples
/
scripts.v2
/
pmtop
blob
cc419ac0772be4317900ab42bae4679f5656c9d0
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