Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/bash/17.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Linux Bash完成编程&x27@';始终在完成字符串中删除_Linux_Bash_Gentoo - Fatal编程技术网

Linux Bash完成编程&x27@';始终在完成字符串中删除

Linux Bash完成编程&x27@';始终在完成字符串中删除,linux,bash,gentoo,Linux,Bash,Gentoo,我正在为Gentoo执行bash完成,它搜索包、集(portage 2.2新功能),但在使用以下命令时遇到了一个问题: 出现@pres 我应该得到@preserved libs,但bash将其转化为: 出现压力 第一个想法是我的脚本“emerge finder.pl”有问题,所以我仔细检查了一下,这个脚本给出了正确的输出 接下来我检查了bash脚本: _portage_cmd () { COMPREPLY=( `~/scripts/emerge-finder.pl ${COMP_

我正在为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剥掉?
非常感谢

引用或转义它可能会有帮助

因此引述:

emerge '@pres'
或逃避:

emerge \@pres

这是可行的,我修改了我的脚本并去掉了前面匹配的“\”,但我仍然不明白为什么“@”会被删除,谢谢-有没有可能在Perl中计算字符串?使用eval?我没有真正理解你,但到目前为止,我的脚本可以给出正确的输出。