On 8 May 2009, at 15:01, Mike Kazantsev wrote:
On Fri, 8 May 2009 14:38:58 +0100
Stroller <strol...@stellar.eclipse.co.uk> wrote:
To find the part to which I refer you'll need to scroll down about
halfway through that page to "Colorize grep"; the author advises
adding:
if echo hello|grep --color=auto l >/dev/null 2>&1; then
export GREP_OPTIONS='--color=auto' GREP_COLOR='1;32'
fi
to ~/.bashrc
Why does he echo hello, please?
Some greps (like BSD one) might not support '--color' option, so "echo
hello|grep --color=auto l" will return error code, skipping if clause,
and won't break grep operation by adding an unsupported option.
Ah! I see! Many thanks!
Stroller.