Are there any examples in the bash 3.0 dist on how to use the programmable
completion features. The man page explains the commands and such, but
a few examples would sure help.
There's a "bash_completion" script floating around (it's included
in the Mandrake Linux distro, and probably others). It's at:
<http://www.dreamind.de/files/bash-stuff/bash_completion>.
It gave me enough information to write this, to complete arguments
to my cpsh script with files in my scripts directory that end in
"-sh":
_cpsh() {
COMPREPLY=( `cd $HOME/scripts || return 3
printf "%s\n" ${COMP_WORDS[$COMP_CWORD]}*-sh`
)
COMPREPLY=( "${COMPREPLY[@]%-sh}" )
}
complete -F _cpsh cpsh
--
Chris F.A. Johnson http://cfaj.freeshell.org
=================================================================
Everything in moderation -- including moderation