« git bash completion | Main | The first fix is free »

.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.

Contacts

melo@simplicidade.org (XMPP/email)
+351 302 029 050 (voice)
melopt (Skype)

IronMan challenge

Iron Man badge Are you ready to be an Iron Man? Join the challenge and find out! (what is the meaning of this little man?)

Moosaico

Junta-te!

Recent Comments

Powered by Disqus
Creative Commons License
This weblog is licensed under a Creative Commons License.
Powered by
Movable Type 3.2