bash の補完機能がおかしくなった

shell の補完機能便利ですよね.
しかし,bash で補完を使おうと tab key を押すとエラーを吐くようになりむしろメッセージで邪魔に.

bash: _comp_initialize: command not found
bash: _comp_initialize: コマンドが見つかりません

この辺が壊れているのかも?

$ ls -l /etc/bash_completion*
-rw-r--r-- 1 root root  45 Jan 25  2020 /etc/bash_completion

/etc/bash_completion.d:
合計 160
-rw-r--r-- 1 root root  17877 Apr 29 07:14 000_bash_completion_compat.bash
-rw-r--r-- 1 root root    439 Feb 15  2022 git-prompt
-rw-r--r-- 1 root root    379 Nov  8 23:18 global-python-argcomplete
-rw-r--r-- 1 root root 135067 Jan 13  2023 gmic

壊れているのなら導入しなおせば治りそう.
ということでこれで bash を起動し直すことで治りました.

$ sudo apt reinstall bash-completion

恐らく先日 diskfull 担ったときに壊れて,その後 bash を起動して発覚したのかな?

環境
$ dpkg-query -W bash*
bash    5.2.15-2+b2
bash-argsparse  1.8.22.ga05fe6d-4~bpo12+1
bash-builtins   5.2.15-2+b2
bash-completion 1:2.11-6
bash-doc
bash-static
$ lsb_release -a
No LSB modules are available.
Distributor ID: Debian
Description:    Debian GNU/Linux 12 (bookworm)
Release:        12
Codename:       bookworm
$ arch
x86_64

コメントを残す

メールアドレスが公開されることはありません。 ※ が付いている欄は必須項目です

Your post must include a link to this post.

How does this work?
Write a response on your own website and include a link to this post. Then submit your response’s URL here. Your response may appear here after moderation. To update or remove it, edit or delete your original post and submit the same URL again. Learn more about Webmentions.