psu 380 B

1234567891011121314151617181920
  1. #!/bin/rc
  2. # psu - ps for just one user
  3. rfork e
  4. flags=()
  5. while (! ~ $#* 0 && ~ $1 -*) {
  6. flags = ($flags $1)
  7. shift
  8. }
  9. # sed -n p rather than grep so that we get buffered writes.
  10. # this is a huge difference in drawterm.
  11. switch($#*){
  12. case 0
  13. ps $flags | sed -n '/^'$user' /p'
  14. case 1
  15. ps $flags | sed -n '/^'$1' /p'
  16. case *
  17. echo Usage: psu '[ps-flags] [ user ]' >[1=2]
  18. exit usage
  19. }