On Saturday 17 June 2006 12:15, Mick wrote:

> I am getting confused here:  why is module building related to setting
> grep's colour option?

There is probably some script that parses the output of grep, and, 
with --color=always, this includes terminal control characters and 
escape sequences which confuse the parser. Using --color=auto, on the 
other hand, is the correct way to do the "right" thing, ie grep 
itself "knows" whether it should emit escape sequences to colorize the 
output (if it's really outputting to terminal) or not (if, for example, 
it's called from inside a command substitution).

The following works:
echo "hello" | grep ello | grep hello


The following does not work, since the output of the first grep 
contains "garbage" (from the point of view of the second grep) between 
the "h" and the "e":

echo "hello" | grep --color=always ello | grep hello   # does not work


Finally, the next one works, because the first grep knows that colorizing 
the output here is useless and does not emit escape sequences:

echo "hello" | grep --color=auto ello | grep hello     # works

HTH
-- 
gentoo-user@gentoo.org mailing list

Reply via email to