Question

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 !

Was it helpful?

Solution

Quoting or escaping it might help...

So quoting :

emerge '@pres'

Or escaping :

emerge \@pres
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top