Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

8
  • 1
    Why don't you alias grep to grep --color=always? Setting GREP_OPTIONS is risky. It's not only completion scripts that are affected. Commented Jan 3, 2016 at 22:28
  • I used to have grep aliased, but it broke far more things than GREP_OPTIONS has since I switched. That forum post says that aliases don't affect scripts, but I've found that to be false. Commented Jan 3, 2016 at 22:30
  • I find that unbelievable, since GREP_OPTIONS affects every instance of grep, but aliases only affect your interactive shell. For aliases to affect scripts, the script has to enable them. And if a script does enable them, then it has no way of knowing what it's running. Commented Jan 3, 2016 at 22:37
  • I just tried switching to an alias as you suggested and it didn't solve the problem I described in my question. So there's that too. Commented Jan 3, 2016 at 22:56
  • Yes, and I created a new terminal, with a new bash session, and checked with echo $GREP_OPTIONS that it was indeed unset. Commented Jan 3, 2016 at 23:16