home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
rtsi.com
/
2014.01.www.rtsi.com.tar
/
www.rtsi.com
/
OS9
/
OSK
/
MISC
/
who.lzh
/
who
< prev
Wrap
Text File
|
1994-02-13
|
1KB
|
44 lines
*help
*
*Syntax: who
*Function: A script to show logged on users
*
*end
*
* Get a list of all active processes and filter this with grep to
* retain shell processes, keep fields 3 and 10-12, then use tr to
* remove < and > from the terminal id. Write this to a temporary file,
* sorted into group.user order.
*
* Field 3 is the group.user and field 11 or 12 is the terminal-id. Field
* 12 comes first as, if it is absent, it vanishes as whitespace. This means
* we always have the first 3 fields as we want them.
*
(procs -e !field 3 10 12 11 !grep shell !tr -d "<>" !qsort -f=1 >/pipe/g.u)&
*
* Get group.user / username pairs from /dd/sys/password and sort on
* group.user. Join this with the group.user list associated with active shells
* and output the result sorted by terminal id.
*
chd /dd/sys
(field 3 1 -i=, <password ! qsort -f=1 >/pipe/pw)&
sleep 2
echo
echo "Term User"
echo
join /pipe/pw /pipe/g.u -f=2.3 -f=1.10 -f=1.2 ! qsort
echo
*
* Notes
*
* 1 The intermediate named pipes are used to make the script neater. At least
* one is needed as two unnamed pipes cant be input to join.
*
* 2 For this script to work correctly, all users must have distinct group.user
* assignments. There are no other special effects.
*