Open RobertBerger opened 8 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.
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:
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.
try this:
alias grep="/usr/bin/grep $GREP_OPTIONS" unset GREP_OPTIONS