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