So when I type:

grep --recTab

I get:

grep --recursive


(and that's a big but) I have defined a few aliases:

alias grep-blue='GREP_COLOR='\''1;34'\'' grep --color=always'
alias grep-red='GREP_COLOR='\''1;31'\'' grep --color=always'
alias grep-yellow='GREP_COLOR='\''1;33'\'' grep --color=always'

which allow me to do funky stuff like this:

gsettings list-recursively | grep-yellow settings | grep-blue power | grep-red true

which gives me: Coloured grep output However in my aliases, there is no prediction for the command-line parameters, so typing:

grep-blue --recTab

doesn't do anything!

and I had a look at:

How do I set up bash completion for command arguments?
How to create script with auto-complete?

but those seem to be a bit outdated and I can't seem to figure it out, because I did find that /usr/share/bash-completion contains:

# makeinfo and texi2dvi are defined elsewhere.
complete -F _longopt a2ps awk base64 bash bc bison cat colordiff cp csplit \
    cut date df diff dir du enscript env expand fmt fold gperf \
    grep grub head indent irb ld ldd less ln ls m4 md5sum mkdir mkfifo mknod \

so I added grep-blue grep-cyan grep-green grep-grey grep-magenta grep-red grep-white grep-yellow \ next to grep but that doesn't seem to help neither!

What am I missing here?

marked as duplicate by dessert command-line Jun 12 '18 at 6:11

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • Interesting question, but... was the unicorn really necessary? ಠ_ಠ – Byte Commander Jun 11 '18 at 22:09
  • It would have been better if it would have been a 14.10 question, but alas, they're off-topic now... :-) – Fabby Jun 11 '18 at 22:13
  • Look at /etc/bash_completion, /etc/bash_completion.d/ – heemayl Jun 11 '18 at 22:27
  • I’m still not used to the hammer, but that’s quite clear I think – if you disagree, you know how to reach me. – dessert Jun 12 '18 at 6:13
  • 1
    Over on U&L: unix.stackexchange.com/q/4219/70524. Also: consider switching to zsh. – muru Jun 12 '18 at 6:16

Browse other questions tagged or ask your own question.