ubuntu 11.04 bash补全的问题

这几天使用ubuntu的命令行时,总是莫名其妙的多少空格。

 

例如$ls /var

在正常情况下应该会出现$ls /var/

但是我现在成了$ls /var空格

老兄,/var是一个目录啊,不是一个文件,不能在后不乱添空格的。

 

这应该是bash补全出了问题。百事问google,竟然找到了:http://timlabath.com/words/2011/05/10/ubuntu-11-04-and-broken-bash-completion/

 

产生问题的原因:https://bugs.launchpad.net/ubuntu/+source/bash-completion/+bug/769866/comments/10

 

对着解决,还真帮上忙了。

About that bash completion…

And then there was the broken bash completion (<tab>-completion.) For example, typing “ls /et<tab>” yielded “ls /etc” and not “ls /etc/” (note the extra space and lack of closing slash at the end.) Reinstalling bash-completion did not fix this problem for me. What did work was removing bash-completion, renaming/etc/bash_completion.d//etc/bash_completion.d.bak/, and then reinstalling bash-completion.


user@machine:~$sudo apt-get purge bash-completion
user@machine:~$sudo mv /etc/bash_completion.d /etc/bash_completion.d.bak
user@machine:~$sudo apt-get install bash-completion


After reinstalling bash-completion, /etc/bash_completion.d/ reappeared. Idiffed the two directories and the new one had way more stuff so I justrm -rfed the old one. I’m happy to say my bash completion is working again and I’m going to file this problem under ‘s.’ For “solved.”


我通过比较文件,然后得出,如果你装了acroread之后,会在这个文件夹下生成acroread.sh

是这个文件影响了补全的问题。


 

意外的收获,自己写程序时,在linux环境中也来个参数补全。

秘密就在/etc/bash_completion.d中。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值