Fancy colors break grep

When I first saw the new fancy colors for the grep command in Linux in Fedora 15 I was happy to see they added colorizing for grep results. It seems to work fine on my Fedora system, but I saw some weird behavior on a CentOS 5.7 system.

I finally narrowed it down to /etc/skel/.bash_profile, which includes the line:

Line 16:
export GREP_OPTIONS=\'--color=auto\'

This file gets copied into all new user’s home directories, and unfortunately causes nothing but issues.

Check out this weird behavior:

[test@servername ~]$ env | grep bash
grep: bash: No such file or directory
[test@servername ~]$ unset GREP_OPTIONS
[test@servername ~]$ env | grep bash

I found this because one of the scripts I wrote used grep and started to fail. Absolutely NOTHING was working with grep, which is a HUGE problem. I wonder if anyone is aware of the problem … someone should probably file a bug report with CentOS or the grep developer or someone who cares.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.