.bash_completion.d
André Cruz asked me why wasn't his ~/.bash_completion.d/
being used by default.
Well, its a feature of the bash_completion
system that you must activate by hand. In my ~/.bashrc
I have the following code:
bash=${BASH_VERSION%.*}; bmajor=${bash%.*}; bminor=${bash#*.}
if [ "$PS1" ] && [ $bmajor -eq 2 ] && [ $bminor '>' 04 ] ; then
if [ -f ~/bin/bash_completion ] ; then
BASH_COMPLETION=~/bin/bash_completion
BASH_COMPLETION_DIR=~/.bash_completion.d
export BASH_COMPLETION BASH_COMPLETION_DIR
. ~/bin/bash_completion
fi
fi
unset bash bmajor bminor
The trick is the BASH_COMPLETION_DIR
setting before you source the bash_completion script. The BASH_COMPLETION
environment is required because I keep a local copy of script.
I'm using the latest version of bash_completion, 20060301. If you download the 20060301 tarball, check the README file. There is a FAQ at the end that mentions this and other cool tricks.