我在bash_completion
文件中启用了.bashrc
。现在,每次我启动终端时,都会向我显示此警告:
bash: [: too many arguments
bash: [: =: unary operator expected
bash: [: =: unary operator expected
bash: [: too many arguments
有关详细信息,请运行此命令:
$ bash .bashrc
它向我显示了这个警告:
/etc/bash_completion.d/gcc: line 50: [: too many arguments
/etc/bash_completion.d/ifupdown: line 3: [: =: unary operator expected
/etc/bash_completion.d/ifupdown: line 19: [: =: unary operator expected
/etc/bash_completion.d/man: line 3: [: too many arguments
/etc/bash_completion.d/gcc
的第50行:
[ $USERLAND = GNU -o $UNAME = Cygwin ] && \
我不知道这里的问题是什么?如何禁止这些警告出现在终端的开头。
修改
我按照Adrian的建议跑了bash -xv .bashrc
,我在输出中找到了这些:
+++ '[' = GNU -o Linux = Cygwin ']'
/etc/bash_completion.d/gcc: line 50: [: too many arguments
.
.
.
+++ '[' = GNU ']'
/etc/bash_completion.d/ifupdown: line 3: [: =: unary operator expected
+++ '[' = GNU ']'
/etc/bash_completion.d/ifupdown: line 19: [: =: unary operator expected
编辑:2
bash -x /etc/bash_completion | grep -E 'UNAME|USERLAND'
++ UNAME=Linux
++ UNAME=Linux
++ unset UNAME RELEASE default dirnames filenames have nospace bashdefault plusdirs
答案 0 :(得分:4)
对您进行疑难解答后,我非常有信心您/etc/bash_completion.d
中的文件属于bash-completion
的旧版本,因此与您拥有的/etc/bash_completion
版本不兼容安装(反之亦然)。
我建议完全卸载bash-completion
:
$ sudo apt-get purge bash-completion
并确认之后没有文件:
$ find /etc/bash_completion*
如果有,请手动删除它们。
之后重新安装bash-completion
:
$ sudo apt-get install bash-completion