选项​​卡上的完整的bash变量扩展 [英] Bash variable expansion on tab complete

查看:111
本文介绍了选项​​卡上的完整的bash变量扩展的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我运行Ubuntu 11.04,和我看到一些奇怪的行为,当我试图与一个变量开始的路径上使用标签,完成在bash。如果我有TOP = /划伤,我尝试标签完成:

CD $ TOP /富

它更改为:

CD \\ $ TOP /富

我倒是preFER它完成于:
CD $ TOP / foobar的
要么
CD /刮/ foobar的
但我会满足于它只是不改变线路,并要求我未逃脱$。

有谁知道在bash / readline的我应该寻找解决这一问题?


解决方案

中找到的错误报告,请注册(如果尚未注册),并自己添加到受灾群众名单,我只是做:

<一个href=\"https://bugs.launchpad.net/ubuntu/+source/bash/+bug/778627\">https://bugs.launchpad.net/ubuntu/+source/bash/+bug/778627

的变通方法

尝试启用 direxpand cdable_vars

 禁用了javascript -s direxpand
# 要么
禁用了javascript -s cdable_vars

显然<一href=\"http://www.linuxquestions.org/questions/linux-general-1/bash-auto-complete-of-environment-variables-613203/#post3023856\">EscTab可能是一个解决办法:


  

我还没有找到这个合适的解决方案,但有一个变通方法。环境变量的转义可以通过pressing Esc后跟标签被禁用。

 #$ CD + SO [Esc键] + [Tab]键
#$ CD SOME_DIR



<子>
确认为bug!我只是证实了同样的事情适用于

 无LSB模块可供选择。
经销商ID:Ubuntu的
说明:Ubuntu的10.10
稿:10.10
codeNAME:特立独行

我得到正常的行为(最多最新)整洁的:

 无LSB模块可供选择。
经销商ID:Ubuntu的
说明:Ubuntu的11.04
稿:11.04
codeNAME:整洁的

虽然我必须补充一点,我做的的斜线逃过一劫,但路径(而有效的,现有的,可访问性和可读性)是没有得到扩大。

信息:<一href=\"https://help.ubuntu.com/community/ReportingBugs\">https://help.ubuntu.com/community/ReportingBugs

I'm running Ubuntu 11.04, and I'm seeing some odd behaviour when I try to use tab-completion in bash on a path that starts with a variable. If I've got TOP=/scratch, and I try to tab-complete:

cd $TOP/foo

it changes to:

cd \$TOP/foo

I'd prefer it to complete to: cd $TOP/foobar or cd /scratch/foobar but I'd settle for it just not changing the line and requiring me to un-escape the $.

Does anyone know where in bash/readline I should look to fix this?

解决方案

Found the bug report, please register (if not already registered) and add yourself to the 'people affected' list, I just did:

https://bugs.launchpad.net/ubuntu/+source/bash/+bug/778627

Workarounds

Try enabling direxpand or cdable_vars:

shopt -s direxpand
# or
shopt -s cdable_vars

Apparently EscTab might be a workaround:

I haven't found a proper solution to this, but there's a workaround. The escaping of environment variables can be disabled by pressing Esc followed by tab.

# cd $SO + [Esc] + [Tab]
# cd $SOME_DIR


Confirm that as a bug! I just confirmed that the same thing works on

No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 10.10
Release:        10.10
Codename:       maverick

I get broken behaviour on (up-to-date) natty:

No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 11.04
Release:    11.04
Codename:   natty

Although I must add that I do not the slash escaped, but the path (while valid, existing, accessible and readable) is not getting expanded.

Info: https://help.ubuntu.com/community/ReportingBugs

这篇关于选项​​卡上的完整的bash变量扩展的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆