[英]Bash will not auto-complete (Tab) with files
Auto-completion in bash (with Tab) works on folders, but not with files. bash中的自动完成(使用Tab)适用于文件夹,但不适用于文件。
This is how the bottom part of the .bashrc file looks, with the bash-completion part installed and updated: 这是.bashrc文件的底部部分的外观,安装和更新了bash-completion部分:
# 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
Any ideas? 有任何想法吗?
The third party "bash_completion" package (not to be confused with bash or its native completion) can sometimes be hard to predict. 第三方“bash_completion”包(不要与bash或其原生完成混淆)有时很难预测。
cd
cd
mplayer
. mplayer
一样。 scp
. scp
。 If you're ever in a situation where bash_completion isn't being helpful, you can use M-/
(aka Alt + /
) to use bash's native filename completion instead. 如果您遇到bash_completion没有帮助的情况,您可以使用
M-/
(aka Alt + /
)来代替使用bash的本机文件名。
If a command is frequently giving you trouble, you can disable bash_completion for this command using complete -r thatcommand
at the end of your .bashrc
. 如果命令经常给您带来麻烦,您可以使用
.bashrc
末尾的complete -r thatcommand
命令禁用此命令的complete -r thatcommand
。
.bashrc file seems ok so the problem probably is in one of the bash_completion files. .bashrc文件似乎没问题所以问题可能出在其中一个bash_completion文件中。
I suggest you backup the files and try to replace them with these: 我建议您备份文件并尝试用以下内容替换它们:
for /etc/bash_completion: for / etc / bash_completion:
http://pastebin.com/0HWHsbyR http://pastebin.com/0HWHsbyR
for /usr/share/bash-completion/bash_completion: for / usr / share / bash-completion / bash_completion:
http://pastebin.com/c49KrbXT http://pastebin.com/c49KrbXT
that are the standard completion files for ubuntu 13.10. 这是ubuntu 13.10的标准完成文件。 Restart the console before checking if it worked.
在检查它是否有效之前重新启动控制台。
One possible cause for this is a file named !
一个可能的原因是一个名为
!
的文件!
. 。 Some default
bash-completion
setups have a bug when such a file exists. 当存在这样的文件时,某些默认的
bash-completion
设置会出现错误 。 You can remove the file or patch /usr/share/bash-completion/bash_completion
as shown in the bug link. 您可以删除文件或补丁
/usr/share/bash-completion/bash_completion
,如错误链接中所示。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.