bug-grep
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#20837: Code for --color=auto


From: Eric Blake
Subject: bug#20837: Code for --color=auto
Date: Wed, 17 Jun 2015 22:07:40 -0600
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.7.0

On 06/17/2015 09:04 PM, Paul J. Lucas wrote:
> On Jun 17, 2015, at 12:52 PM, Eric Blake <address@hidden> wrote:
> 
>> But you don't always want color when piping.
> 
> I know.  I was asking specifically about what grep does (or should do) only 
> when the user supplies —color=auto.
> 
>> No, we want --color=auto to be tied SPECIFICALLY to a tty…
> 
> Because…?

Historical precedence and consistency among all GNU apps that support
--color=auto.  And because:

alias grep='grep --color=auto'
grep | grep

should NOT colorize the first grep's output, even though it is going
into a pipe to the second grep.  When you WANT color as a non-default
(or to disable color when outputting to a tty), then you can temporarily
override your alias:

grep --color=always | grep

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]