grep
doesn't allow setting color by
grep --color='1;32'
(1 meaning bold, and 32 meaning green). It has to use GREP_COLOR by
export GREP_COLOR='1;32'
and then use grep --color
How do we alias or write a function for grep so that we have 2 versions of grep (say, grep and grepstrong), one for usual green font, and the other one, green font with a black (or white) background?
alias grep='export GREP_COLOR="1;32"; grep --color'
won't work because if we use
grep some_function_name | grep 3
then the above alias will generate results of the grep, and pipe into export
, so the second grep won't get any input at all and just waiting there.