bash自动完成失败,并带有通配符

all_meije

使用bash此此系统上:

Linux 3.16.0-4-amd64#1 SMP Debian 3.16.7-ckt20-1 + deb8u4(2016-02-29)x86_64 GNU / Linux

序列:

cd /tmp
touch test1.txt && touch test2.txt && touch test3.txt
ls test [tab][tab]

显示:

test1.txt test2.txt test3.txt

在命令行下方。

这就是我期望bash自动完成的行为。

但是当我键入:

ls test* [tab][tab]

(预期结果相同)我只能得到(即,自动完成功能仅扩展为):

test1.txt

因此,*末尾的星号()通配符表示test[23].txt“无法访问”。我很确定这两个序列在​​以前的bash版本中提供了相同的结果-至少在我的计算机上。

还有其他人有这个问题吗?可以更改的默认设置(例如在Debian 8中)吗?(我试图设置和取消设置不同的shell参数,shopt但无济于事)。

all_meije

好了,对我有用的解决方案是:在~/.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

我认为那是可以解决自动补全的功能。在注释掉它并启动一个新的shell之后,它不仅可以工作,而且可以恢复到我以前的习惯!

仍然不确定if-clause是什么意思,但是在它起作用时我不会尝试对其进行修复。

本文收集自互联网,转载请注明来源。

如有侵权,请联系 [email protected] 删除。

编辑于
0

我来说两句

0 条评论
登录 后参与评论

相关文章