如何摆脱 `grep: warning: GREP_OPTIONS is deprecated;请使用别名或脚本?

How to get rid of `grep: warning: GREP_OPTIONS is deprecated; please use an alias or script`?

我在 Arch linux 上安装了 zsh + zprezto。每次我打开控制台时,都会显示烦人的警告:

grep: warning: GREP_OPTIONS is deprecated; please use an alias or script

遵循 [SOLVED] grep: warning: GREP_OPTIONS is deprecated 中的说明没有帮助。我怎样才能摆脱这个警告?

~/.zpreztorc 中的以下设置导致显示烦人的警告消息:

zstyle ':prezto:*:*' color 'yes'

刚才注释掉了,现在好了。警告消失了。

只需使用以下方法取消设置环境变量:

unset GREP_OPTIONS

由于 GREP_OPTIONS 已弃用,如果您为其设置了一个值,例如

export GREP_OPTIONS='--exclude-dir=__pycache__'

只需将其移动到别名即可:

alias grep='grep --exclude-dir=__pycache__'