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 ba开发者_运维百科sh 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 !
Quoting or escaping it might help...
So quoting :
emerge '@pres'
Or escaping :
emerge \@pres
精彩评论