unset GREP_OPTIONS (alias grep instead) to get an “acceptable egrep”

Building some software from source, I recently encountered

checking for egrep... configure: error: no acceptable egrep could be found in /usr/local/bin:/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games:/usr/xpg4/binL

and couldn’t find a solution anywhere. In the shower I remembered setting GREP_OPTIONS in my environment. That seems to have been the problem. After unsetting GREP_OPTIONS and obtaining the same default behavior for myself with

alias grep='grep --color=auto --perl-regexp'

the error went away. I guess configure is finding and running /bin/grep, which is affected by the environment, but bypasses any aliases.

2 Responses

  1. […] 20120421: Use an alias in place of setting the environment variable: alias grep='grep –color=auto […]

  2. Stéphane says:

    Thank you so much, was about to mess up my system when I found your post, and got it working by unsetting my GREP_OPTIONS as well. Cheers!

Leave a Reply