Cover image for post Bash completion for the PEAR Installer

Bash completion for the PEAR Installer

I always wanted to have the PEAR commands get auto completed on my bash. Here is how it works:

complete -W "`pear 2>&1 | awk '{ORS=" "} /[a-zA-Z-]+ / {print $1}'`" -f pear

Simply run the command in your shell and/or add it to e.g. your .bashrc. You will have autocompletion for all PEAR Installer commands and for filenames in paralell.

Usually I'd have expected to get the stuff working using complete's "-C" option, this did not work for me, I got a list of all possible commands when typing <tab><tab>, but neither a correct completion suggestion nor a completion.