有:未找到命令

Abh*_*ran 5 bash grub2

我创建了自己的linux。每当我打开 bash 并登录到子 shell 时,都会收到以下错误

-bash: have: command not found
-bash: have: command not found
-bash: have: command not found
-bash: have: command not found
-bash: have: command not found
-bash: have: command not found
-bash: have: command not found
Run Code Online (Sandbox Code Playgroud)

它会显示多次。为了调试它,我执行了以下命令:

bash --login -x
Run Code Online (Sandbox Code Playgroud)

输出:

+ source /etc/locale.conf
++ LANG=en_US.UTF-8
+ for f in '/etc/bash_completion.d/*'
+ '[' -e /etc/bash_completion.d/grub ']'
+ source /etc/bash_completion.d/grub
+++ echo grub-set-default
+++ sed s,x,x,
++ __grub_set_default_program=grub-set-default
++ have grub-set-default
bash: have: command not found
++ unset __grub_set_default_program
+++ sed s,x,x,
+++ echo grub-reboot
++ __grub_reboot_program=grub-reboot
++ have grub-reboot
bash: have: command not found
++ unset __grub_reboot_program
+++ echo grub-editenv
+++ sed s,x,x,
++ __grub_editenv_program=grub-editenv
++ have grub-editenv
bash: have: command not found
Run Code Online (Sandbox Code Playgroud)

输出太长,无法粘贴到此处。但这个片段显示了错误。错误在/etc/bash_completion.d/grub文件中。该文件正在调用have. 重新安装 grub 并没有修复该错误。那么,我该如何解决这个错误呢?

cof*_*Mug 3

看来您的 Linux 中缺少 bash 补全。

另请参阅这篇文章bash 补全的“have”关键字