无法在没有反斜杠的情况下对系统变量进行制表符补全

发布于 2024-07-18 07:17:20 字数 213 浏览 4 评论 0原文

我的 inputrc 是空的。 我用的是巴什。

问题: 我按

cd $te

Tab 键,然后得到

cd \$test

如何在 Bash 中没有反斜杠的情况下完成 Tab 键补全?

My inputrc is empty. I use Bash.

Problem:
I am at

cd $te

I press Tab, and I get

cd \$test

How can you have the tab completion without the backslash in Bash?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

百变从容 2024-07-25 07:17:20

你不知道。 在 Bash 中,$ 用于检索变量。 例如:

SWEETVAR='hi'
echo $SWEETVAR

因此,文件或文件夹名称中的 $ 必须进行转义,否则它会被解释为 var。

You don't. In Bash, a $ is used in the retrieval of variables. For example:

SWEETVAR='hi'
echo $SWEETVAR

Because of this, a $ in the name of a file or folder must be escaped, else it is interpreted as a var.

难理解 2024-07-25 07:17:20

问题似乎出在 MacPorts 上。

它有一个旧版本的 Bash_completion。

最新版本有以下内容,

complete -o nospace -F _cd cd

而我在执行命令后有以下内容,

$complete | grep cd
complete -o filenames -o nospace -F _cd cd

我向 MacPorts 的 irc 发送了一条评论以更新 bash-completion @20060301 (sysutils)。

The problem seems to be in MacPorts.

It has an old version of Bash_completion.

The newest version has the following in

complete -o nospace -F _cd cd

while I have the following after executing the command

$complete | grep cd
complete -o filenames -o nospace -F _cd cd

I sent a comment to MacPorts' irc to update bash-completion @20060301 (sysutils).

爱人如己 2024-07-25 07:17:20

我终于搬到了Zsh。
它为我解决了问题。

I finally moved to Zsh.
It solved the problem for me.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文