# chkconfig(8) completion -*- shell-script -*- proc _chkconfig { local cur prev words cword split _init_completion -s || return match $prev { with --level=[1-6]|[1-6]|--list|--add|--del|--override _services _xinetd_services return 0 with --level setglobal COMPREPLY = ''( $( compgen -W '{1..6}' -- "$cur" ) ) return 0 } $split && return 0 if [[ "$cur" == -* ]] { setglobal COMPREPLY = ''( $( compgen -W '--list --add --del --override --level' \ -- "$cur" ) ) } else { if [[ $cword -eq 2 || $cword -eq 4 ]] { setglobal COMPREPLY = ''( $( compgen -W 'on off reset resetpriorities' \ -- "$cur" ) ) } else { _services _xinetd_services } } } && complete -F _chkconfig chkconfig # ex: ts=4 sw=4 et filetype=sh