Bash补全编程,'@'总是在完成字符串中删除
我正在为 Gentoo 进行 bash 补全,它搜索包、设置(portage 2.2 新功能),但是当我使用以下命令时遇到了问题:
出现@pres
我应该得到 @preserved-libs ,但是 bash 将其变成:
出现压力
首先想到的是我的名为“emerge-finder.pl”的脚本有问题,所以我仔细检查了,这个脚本给出了正确的输出。
接下来我检查了 bash 脚本:
_portage_cmd () {
COMPREPLY=( `~/scripts/emerge-finder.pl ${COMP_WORDS[COMP_CWORD]}` )
}
complete -F _portage_cmd em
我在 COMPREPLY 行之前放置了一个“echo ${COMP_WORDS[COMP_CWORD]}”,并且没有“@”字符的输出,连线。
我怎样才能防止我的“@”被 bash 剥掉? 非常感谢!
I'm doing a bash completion for Gentoo , which search for packages , sets ( portage 2.2 new feature ) , but i met a problem when i'm using the following command:
emerge @pres
And i'm supposed to get @preserved-libs , but bash turns it into:
emerge pres
First thought would be problem with my script called "emerge-finder.pl" , so i double checked , and this script gave the right output.
And next i checked bash script:
_portage_cmd () {
COMPREPLY=( `~/scripts/emerge-finder.pl ${COMP_WORDS[COMP_CWORD]}` )
}
complete -F _portage_cmd em
And i put a "echo ${COMP_WORDS[COMP_CWORD]}" before COMPREPLY line , and there's no output of "@" character , wired.
How can i keep my "@" from stripping off by bash ?
Many thanks !
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
引用或转义它可能会有所帮助...
所以引用:
或转义:
Quoting or escaping it might help...
So quoting :
Or escaping :