I have a git repository where I keep some statically-linked binaries along with related man files and bash completion files, which are all 'installed' using GNU Stow to make the symlinks.
I have previously put the symlinks for the bash completion files in /etc/bash_completion.d
with no issues, but recently I have started putting them in /usr/share/bash-completion/completions
instead, as I thought it was a more correct location for them, seeing as the binaries were going in /usr/local/bin
and the man files in /usr/local/share/man
.
Everything works as before apart from four specific bash completion files, which are no longer working when placed in this new location. These are:
And these two for fzf:
I have 20 other bash completion files that work fine. What is it about these specific bash completion files that make them work while in /etc/bash_completion.d
with no issues but not in /usr/share/bash-completion/completions
?
EDIT:
They also don't work in ~/.local/share/bash-completion/completions
either.
Additional information:
The files are sourced by the standard Debian/Ubuntu .bashrc
lines:
# Enable programmable completion features
if ! shopt -oq posix; then
if [ -f /usr/share/bash-completion/bash_completion ]; then
. /usr/share/bash-completion/bash_completion
elif [ -f /etc/bash_completion ]; then
. /etc/bash_completion
fi
fi
In both locations it is not the contents on directories are that being sourced, but these two files:
/usr/share/bash-completion/bash_completion
The second file simply points to the first file if NOT shopt -oq posix
. On my setup:
$ if ! shopt -oq posix; then echo "not posix"; fi
not posix
I think the answer must be in /usr/share/bash-completion/bash_completion.
More:
I tried replacing bash_completion
with the latest version but that doesn't work either.
https://github.com/scop/bash-completion
Also..
These files do not work when placed in ~/.local/share/bash-completion/completions
either.
type _git_identity
say for example?bash: type: _git_identity: not found