Today I Learned: collection of notes, tips and tricks and stuff I learn from day to day working with computers and technology as a developer

View project on GitHub

Create directory for own bash completions

When you implement your own bash completions you can with luck install them in a local directory in your $HOME directory and then create a small shell helper script to source these.

Create the file: ~/.bash_completion, containing the code below:

for bcfile in ~/.bash_completion.d/* ; do
  . $bcfile

Create a directiory for your completions:

$ mkdir ~/.bash_completion.d

Copy your completions into the newly created directory:

$ cp your_bash_completion ~/.bash_completion.d/

Start a new shell and you should be good to go.