LoginSignup
0
2

More than 3 years have passed since last update.

bash_completionをユーザー個別に設定

Posted at

環境

OS: 18.04.1-Ubuntu
bash-completion: Version: 1:2.8-1ubuntu1

経緯

  • ユーザー個別のcliアプリケーションをinstallした
  • ので、ユーザー個別のbash_completionを設定したくなった
  • sourceで読めばどうとでもなるが、どこに配置すべきかなやんだので調べてみた

結論

配置場所は~/.config/bash_completion*が正しい。

よって私は以下のようにする

~/.config/
└── bash_completion
└── bash_completion.d/
    ├ aaa
    └ bbb
~/.config/bash_completion
# 本家のコードのマネ
# https://github.com/scop/bash-completion/blob/aa3652b6b7de9aabfafa79f52c70825f23f967ab/bash_completion#L2143
compat_dir="${XDG_CONFIG_HOME:-$HOME/.config}/bash_completion.d"
if [[ -d $compat_dir && -r $compat_dir && -x $compat_dir ]]; then
    for i in "$compat_dir"/*; do
        [[ ${i##*/} != @($_backup_glob|Makefile*|$_blacklist_glob) \
            && -f $i && -r $i ]] && . "$i"
    done
fi

詳細

0
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
2