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   
Text File  |  1994-02-13  |  1KB  |  44 lines

  1. *help
  2. *
  3. *Syntax:   who
  4. *Function: A script to show logged on users
  5. *          
  6. *end
  7. *
  8. * Get a list of all active processes and filter this with grep to
  9. * retain shell processes, keep fields 3 and 10-12, then use tr to 
  10. * remove < and > from the terminal id. Write this to a temporary file,
  11. * sorted into group.user order.
  12. *
  13. * Field 3 is the group.user and field 11 or 12 is the terminal-id. Field
  14. * 12 comes first as, if it is absent, it vanishes as whitespace. This means 
  15. * we always have the first 3 fields as we want them.
  16. *
  17. (procs -e !field 3 10 12 11 !grep shell !tr -d "<>" !qsort -f=1 >/pipe/g.u)&
  18.  
  19. *
  20. * Get group.user / username pairs from /dd/sys/password and sort on 
  21. * group.user. Join this with the group.user list associated with active shells
  22. * and output the result sorted by terminal id.
  23. *
  24. chd /dd/sys
  25. (field 3 1 -i=, <password ! qsort -f=1 >/pipe/pw)&
  26.  
  27. sleep 2
  28. echo 
  29. echo "Term    User"
  30. echo
  31. join /pipe/pw /pipe/g.u -f=2.3 -f=1.10 -f=1.2 ! qsort
  32. echo
  33.  
  34. *
  35. * Notes
  36. *
  37. * 1    The intermediate named pipes are used to make the script neater. At least 
  38. *   one is needed as two unnamed pipes cant be input to join.
  39. *
  40. * 2    For this script to work correctly, all users must have distinct group.user
  41. *   assignments. There are no other special effects.
  42. *
  43.  
  44.