Bash Completion and Brew instructions for setting up completions


(Ian Max Andolina) #1
Add the following line to your ~/.bash_profile:
[ -f /home/linuxbrew/.linuxbrew/etc/bash_completion ] && . /home/linuxbrew/.linuxbrew/etc/bash_completion

Bash completion has been installed to:
/home/linuxbrew/.linuxbrew/etc/bash_completion.d

As you can see, the recommended text to set up bash completion is not consistent with where bash completions are actually stored, you need to use . $(brew --prefix)/etc/bash_completion.d/* – this also seems to be the case under macOS.

The instructions on brew.sh are also incorrect: https://docs.brew.sh/Shell-Completion


(Sean Molenaar) #2

Good find, could you make a pull request to change it?


(Ian Max Andolina) #3

For the documentation: https://github.com/Homebrew/brew/pull/5511
For the formula: https://github.com/Homebrew/homebrew-core/pull/35817

I’m a bit confused by the formula:

the install tries to edit bash_completion, yet the final folder is bash_completion.d - I assume the package itself does this, then all that is needed is to change the caveat text, but please double check…


(Sean Molenaar) #4

It looks like it’s just editing the path there and the path was /etc/bash_completion.d for a while.