Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

killall completion



Hi!

Yet another old-style/compctl completion, this time for killall; perhaps
worth including in zsh completion archive batch supplied with zsh:s? It's
designed for the ps of SunOS 5.7 or the ps shipped with Red Hat Linux
(where ps --version says "procps version 1.2.7").

functions complete-killall () 
{
  if [[ "$(uname)" == "SunOS" ]]; then
      reply=($(ps -o comm|sed '1d;s/^-//'|awk -F/ '{print $NF}'|sort|uniq))
  else
      reply=($(ps alwww|cut -b72-|egrep -v '^\('|sed '1d;s/^-//;s/ .*//'|awk -F/ '{print $NF}'|sort|uniq))
  fi
}

compctl -K complete-killall killall

Could be improved by somehow filtering out the commands of the pipe chain
from the completion namespace, but I couldn't come up with a working
scheme within five minutes, so I dropped the idea. :-)

Other possible future improvement is a wider process scope (ps -a/-e
respectively) if UID==0. Comments, improvements and general thoughts
always welcome!

 /Johan Sundström (non-subscriber)



Messages sorted by: Reverse Date, Date, Thread, Author