When I run egrep
, it shows warning: egrep is obsolescent; using grep -E
But I'm using it as part of my shell autocomplete script that I often use, and I don't want to rewrite them.
I'm looking for way to suppress those warnings, since my autocomplete become 'ugly', e.g.: when typing mycmd myargum<TAB>
, I'm expecting autocomplete to make it mycmd myargument
, but instead it writes:
mycmd myargum<TAB>grep: warning: egrep is obsolescent; using grep -E
grep: warning: egrep is obsolescent; using grep -E
ent
Currently I tried doing this:
mv /usr/bin/egrep /usr/bin/egrep.backup
echo 'grep -E $@' > /usr/bin/egrep
chmod a+x /usr/bin/egrep
It works by changing the grep binary to a script that calls 'grep -E' instead.
Additional info:
$ egrep.backup --version
egrep.backup: warning: egrep.backup is obsolescent; using grep -E
grep (GNU grep) 3.8
Copyright (C) 2022 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <https://gnu.org/licenses/gpl.html>.
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Written by Mike Haertel and others; see
<https://git.sv.gnu.org/cgit/grep.git/tree/AUTHORS>.
The question is:
- Is this method okay? Will it have unintended consequences?
- Maybe it will make egrep.backup binary still undeleted if grep package is uninstalled/purged, but this should be non issue as I never planned to do that
- Is there any better way to suppress this warning message?
alias egrep="grep -E"
in .bashrc since alias is prioritized over $PATH from https://unix.stackexchange.com/a/132628/477417 – Kristian Dec 08 '22 at 03:54egrep
so that they usegrep -E
instead.egrep
has been deprecated for decades now, that's more than enough time to stop using it. – cas Dec 08 '22 at 04:58echo 'grep -E "$@"' > /usr/bin/egrep
, ie double quote the$@
– Chris Davies Dec 08 '22 at 06:49egrep
is completely removed? – Bib Dec 08 '22 at 15:30