GNU bug report logs -
#55641
Using colours with grep
Previous Next
Full log
View this message in rfc822 format
On 2022-05-28, goncholden wrote:
> I was trying to change the colours used for matching temporarily.
> But GREP_COLORS is global in nature.
An environment variable such as GREP_COLORS set by itself on the
command line persists in the environment after it has been set. An
environment variable set on the same line as a command, such as
GREP_COLORS='ms=01;32' grep this_pattern that_file
affects only the environment of that command, persists only for the
duration of that command, and does not affect the shell's
environment.
That may not be completely accurate, but it's close.
So, setting GREP_COLORS on the grep command line as above will
affect only that command and will not affect the "global" setting,
as you put it.
See the ENVIRONMENT section of the bash(1) man page.
Regards,
Gary
This bug report was last modified 2 years and 320 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.