bashcompgen

Bash: compgen How to get rid of Warning message [option may not work as you expect]?


I am making a simple bash completion program using compgen

however when using compgen -F option, the warning message keep prompt out and break my list of work

I am using Ubuntu 12.04. How can I get rid of this or debug it? Thanks

kithokit@09:54:25 ~ $ compgen -F a
bash: compgen: warning: -F option may not work as you expect

Solution

  • You can get rid of the warning like this:

    compgen -F a 2>/dev/null
    

    but unfortunately that will also discard any real error message from compgen.

    As far as I can see from the bash source code, there is no other way to suppress the message, but I didn't look really deep.