Subject: bug#20883: egrep on Solaris fails to call original grep binary

From: Vladimir Marek <[email-masked]>
Date: Fri, 26 Jun 2015 17:09:34 +0200

> >$ PATH=/usr/bin gegrep
> >grep: illegal option -- E
> 
> On recently-patched Solaris 10 with bleeding-edge GNU grep, I see the
> following instead:
> 
>   $ PATH=/usr/bin gegrep
>   gegrep: not found
> 
> The above behavior is with /bin/sh, and with gegrep installed in some
> directory that is in my ordinary PATH but not in /usr/bin.
> 
> >The gegrep script:
> >
> >#!/bin/bash
> >grep=grep
> >case $0 in
> >  */*)
> >    dir=${0%/*}
> >    if test -x "$dir/grep"; then
> >      PATH=$dir:$PATH
> >      grep=grep
> >    fi;;
> >esac
> >exec $grep -E "$@"
> 
> Assuming you configure this way:
> 
>   ./configure --prefix=/my/dir --program-prefix=g
> 
> (which is how I did it), the egrep script in bleeding-edge grep (obtained
> from savannah via git) should be much simpler:
> 
>   #!/bin/bash
>   exec ggrep -E "$@"

That's a nice simplification of the previous state :)

> and this may fix your problem (though I admit I don't understand your
> problem).  The egrep script was simplified as part of the fix for Bug#19998;
> see:
> 
> http://bugs.gnu.org/19998#37
> 
> By the way, probably you know this already, but portable scripts should not
> use egrep or fgrep, as these two commands have been removed from POSIX.
> They should use 'grep -E' and 'grep -F' instead.

Thank you for the pointer, it helps. Also sorry for the not-so-clear
report, after thinking about it twice, the problem in Solaris is that we
provide both variants. With 'g' prepended and without. So I have to make
the script a little bit more difficult.

Thanks for your time looking at this and your help

-- 
	Vlad