# postconf(1) completion -*- shell-script -*- proc _postconf { var cur = '', prev = '', words = '', cword = '' _init_completion || return var eqext = '' match $prev { with -b|-t _filedir return 0 with -c _filedir -d return 0 with -e set cur = $(cur#[\"\']) set eqext = ''='' } if [[ $cur == -* ]] { setglobal COMPREPLY = '( '$( compgen -W '$( _parse_usage "$1" )' -- "$cur" ) ) return 0 } var len = $(#cur), idx = '0', pval = '' for pval in [$[ /usr/sbin/postconf !2 >/dev/null | cut -d ' ' -f 1]] { if [[ "$cur" == "${pval:0:$len}" ]] { setglobal COMPREPLY[$idx]="$pval$eqext" set idx = $shExpr('$idx+1') } } return 0 } && complete -F _postconf postconf # ex: ts=4 sw=4 et filetype=sh