[英]Bash completion programming , '@' is always removed in completion string
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: 我正在为Gentoo进行bash补全,它会搜索程序包,集合(portage 2.2新功能),但是当我使用以下命令时遇到了一个问题:
emerge @pres
出现@pres
And i'm supposed to get @preserved-libs , but bash turns it into: 我应该得到@ preserved-libs,但是bash将其转换为:
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. 首先想到的是我的脚本“ emerge-finder.pl”的问题,所以我仔细检查了一下,此脚本给出了正确的输出。
And next i checked bash script: 接下来我检查了bash脚本:
_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. 我在COMPREPLY行之前放了一个“ echo $ {COMP_WORDS [COMP_CWORD]}},并且没有输出” @“字符,已连接。
How can i keep my "@" from stripping off by bash ? 我如何防止我的“ @”被bash剥夺? Many thanks !
非常感谢 !
Quoting or escaping it might help... 引用或转义它可能会有所帮助...
So quoting : 所以引用:
emerge '@pres'
Or escaping : 或转义:
emerge \@pres
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.