# pgrep(1) and pkill(1) completion -*- shell-script -*- proc _pgrep { local cur prev words cword _init_completion || return match $prev { with -c|-d|--delimiter|-g|--pgroup|-J|-M|-N|-s|--session|-t|--terminal|-T|-z return with --signal _signals return with -F|--pidfile _filedir return with -G|--group _gids return with -j setglobal COMPREPLY = ''( $( compgen -W 'any none' -- "$cur" ) ) return with -P|--parent _pids return with -u|--euid|-U|--uid _uids return } if [[ $cur == -* ]] { local help='$( _parse_help "$1" )' [[ $help ]] || setglobal help = ''$( "$1" --usage 2>&1 | sed -e "s/\[-signal\]//" -e "s/\[-SIGNAL\]//" | _parse_usage - )'' setglobal COMPREPLY = ''( $( compgen -W "$help" -- "$cur" ) ) [[ $cword -eq 1 && $1 == *pkill ]] && _signals - return } _pnames -s } && complete -F _pgrep pgrep pkill # ex: ts=4 sw=4 et filetype=sh