I recently found that on Mac OS X I can set this up in my shell ~/.profile
so that when I use grep
it will print the matches in color (white one red).
alias grep='GREP_COLOR="1;37;41" LANG=C grep --color=auto'
But setting up an alias seems like kind of a hack way to do this. Previously I had tried with no luck:
export GREP_COLOR=always # works fine in Linux
And then I also tried:
export GREP_COLOR="1;37;41"
Is there a better way to do this than setting up an alias?
export
the environment variable e.g. in.bash_profile
, and definealias grep='grep --color'
, and you're done.export GREP_OPTIONS='--color=auto'