watchfd 361 B

1234567891011121314151617
  1. #!/bin/rc
  2. p=`{ps | grep $1 | sed 's/[^ ]* +([^ ]+) .*/\1/' }
  3. while(! ~ $#p 1) {
  4. sleep 1
  5. p=`{ps | grep $1 | sed 's/[^ ]* +([^ ]+) .*/\1/'}
  6. }
  7. p=$p(1)
  8. baropt='-w 145,129,445,168'
  9. if(~ textinst 1)
  10. baropt=-t
  11. {
  12. while(test -f /proc/$p/fd)
  13. grep '^ *'^$2^' ' /proc/$p/fd >[2]/dev/null
  14. } | awk '{print $9 " '^$3^'"; fflush("/dev/stdout")}' | bargraph $baropt $4