Use different colors for every another grep
You could add the following to your .bashrc
file:
my_grep() {
if $GREP_USE_FIRST_COLOR
then
export GREP_USE_FIRST_COLOR=false
export GREP_COLORS='ms=01;31:mc=01;31:sl=:cx=:fn=35:ln=32:bn=32:se=36'
else
export GREP_USE_FIRST_COLOR=true
export GREP_COLORS='ms=01;33:mc=01;33:sl=:cx=:fn=35:ln=32:bn=32:se=36'
fi
grep --color=auto "$@"
}
alias grep=my_grep
This will alter the match highlighting color of subsequent grep
calls in an interactive shell between bold red (ms=01;31
) and bold yellow (ms=01;33
).
See the grep manual for more information on how to use GREP_COLORS
to set the particular highlighting colors you like.