Public bug reported: (Doing this in reverse order, as I think the steps are best represented by what I actually type in.)
Premise: I'm a newbie who tries to do the nasty and make grep output always colored using GREP_OPTIONS. I have a file called test, with numbers 1-9 each on its own line. What I expect to happen: For all the numbers I grep from my file except 2 to be colored. What actually happens: Neither when preceding the grep with GREP_OPTIONS when I grep 4, nor when GREP_OPTIONS is exported prior to grepping 5, is the resulting output colored. What does work: Passing --color=always as a genuine grep parameter. Passing (for example) -V in GREP_OPTIONS either on the same line or exported. Additional notes: This crippling might be some kind of a safety measure to prevent all the breakage that doing what I'm attempting to do risks inflicting on the system. But I've not been able to find any documentation about such a design decision having been made, and in contrast, the man page to my understanding implies that this should, in fact, work. Steps to reproduce: jani@saegusa:~$ printenv | grep -i grep jani@saegusa:~$ grep 1 test # colored 1 jani@saegusa:~$ grep 2 test | cat # not colored 2 jani@saegusa:~$ grep --color=always 3 test | cat # colored 3 jani@saegusa:~$ GREP_OPTIONS='--color=always' grep 4 test | cat # NOT colored! 4 jani@saegusa:~$ export GREP_OPTIONS='--color=always' jani@saegusa:~$ grep 5 test | cat # NOT colored! 5 jani@saegusa:~$ export GREP_OPTIONS='-V' jani@saegusa:~$ grep 6 test | cat # control grep (GNU grep) 2.10 Copyright © 2011 Free Software Foundation, Inc. Lisenssi GPLv3+: GNU GPL versio 3 tai myöhäisempi <http://gnu.org/licenses/gpl.html> Tämä on vapaa ohjelma: voit vapaasti muuttaa ja jakaa sitä edelleen. Ohjelmalla EI OLE TAKUUTA siinä laajuudessa kuin laki sen sallii. Tekijät: Mike Haertel ja muut, katso <http://git.sv.gnu.org/cgit/grep.git/tree/AUTHORS>. ProblemType: Bug DistroRelease: Ubuntu 12.04 Package: grep 2.10-1 ProcVersionSignature: Ubuntu 3.2.0-10.17-generic 3.2.1 Uname: Linux 3.2.0-10-generic x86_64 ApportVersion: 1.91-0ubuntu1 Architecture: amd64 CheckboxSubmission: 09ae689090491ca53449589269e4bfd8 CheckboxSystem: edda5d4f616ca792bf437989cb597002 Date: Tue Jan 24 20:45:31 2012 EcryptfsInUse: Yes InstallationMedia: Ubuntu 9.10 "Karmic Koala" - Release amd64 (20091027) SourcePackage: grep UpgradeStatus: Upgraded to precise on 2012-01-17 (7 days ago) ** Affects: grep (Ubuntu) Importance: Undecided Status: New ** Tags: amd64 apport-bug precise running-unity -- You received this bug notification because you are a member of Ubuntu Bugs, which is subscribed to Ubuntu. https://bugs.launchpad.net/bugs/921154 Title: Ignores --color=always in GREP_OPTIONS To manage notifications about this bug go to: https://bugs.launchpad.net/ubuntu/+source/grep/+bug/921154/+subscriptions -- ubuntu-bugs mailing list ubuntu-bugs@lists.ubuntu.com https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs