- 出现问题
我也不知道为什么,今天下午开机安装软件的时候发现,在命令行输入sudo apt-get ins
然后按tab
键,发现居然不能补全了!!!!
然后我手动补全sudo apt-get install
后面接软件的名称,发现居然可以安装,瞬间感觉不好了。然后用root帐号试了试apt-get ins
之后可以自动补全,那么问题就来了:问题出在哪? - 寻找方法
我用的时bash shell,于是看了一下.bashrc
文件,发现有这么个配置
# enable programmable completion features (you don't need to enable
# this, if it's already enabled in /etc/bash.bashrc and /etc/profile
# sources /etc/bash.bashrc).
然后我又翻了一下 /etc/bash.bashrc
发现下面也有同样的配置,不过下面多了点东西:
# enable programmable completion features (you don't need to enable
# this, if it's already enabled in /etc/bash.bashrc and /etc/profile
# sources /etc/bash.bashrc).
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
就是在/usr/share/bash-completion/bash_completion
加载失败的情况下去加载 /etc/bash_completion
,猜想是不是这货挂了,于是sudo apt-get install bash_completion
,系统提示软件已经时最新版本了。抓狂。。。。。
然后就把原来的.bashrc
文件备份了一下,将/etc/bash.bashrc
文件里面的上述代码放在的 .bashrc
文件里面,然后重新加载一下资源source .bashrc
,发现可以补全了。
3. 问题解释
别问我为什么,我也不清楚,弄明白了之后会在这解释一下,有知道的大神可以在后面留言评论一下, 先行谢过。