RobertBerger / yocto-autobuilder

docker file for yocto autobuilder
GNU General Public License v2.0
8 stars 0 forks source link

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

Open RobertBerger opened 8 years ago

RobertBerger commented 8 years ago

try this:

alias grep="/usr/bin/grep $GREP_OPTIONS" unset GREP_OPTIONS

k00ni commented 6 years ago

Hi, i know this "issue" is old, but i tried it your way and ran into a problem. After running the following on a Ubuntu 16.04 machine:

alias grep="/usr/bin/grep $GREP_OPTIONS"
unset GREP_OPTIONS

i got the following error message:

German:

zsh: datei oder Verzeichnis nicht gefunden: /usr/bin/grep

English (translated freely):

zsh: file or folder not found: /usr/bin/grep

I could fix it by doing the running command on my terminal instead:

alias grep='grep -n --color'

I found this solution here. To be a permanent solution, i guess you have to adapt your ~/.bashrc and add this line or adapt the existing one.

RobertBerger commented 6 years ago

Yes I am aware of the fact, that GREP_OPTIONS is not supported anymore in recent distros and on Ubuntu 16 the trick above does not work. To make the alias you suggest will work on the command line, but not from within scripts;) I want it to work form script as well, so I did a small function which I call from my scripts. Something like that:

!/bin/bash

color grep

function color_grep () { grep --color -E ${1} }

export GREP="color_grep"


From within my scripts in case I want a colored grep I call ${GREP} instead of grep.