GNU bug report logs - #20883
egrep on Solaris fails to call original grep binary

Previous Next

Package: grep;

Reported by: Vladimir Marek <Vladimir.Marek <at> oracle.com>

Date: Tue, 23 Jun 2015 15:40:02 UTC

Severity: normal

Done: Paul Eggert <eggert <at> cs.ucla.edu>

Bug is archived. No further changes may be made.

Full log


Message #8 received at 20883 <at> debbugs.gnu.org (full text, mbox):

From: Paul Eggert <eggert <at> cs.ucla.edu>
To: Vladimir Marek <Vladimir.Marek <at> oracle.com>, 20883 <at> debbugs.gnu.org
Subject: Re: bug#20883: egrep on Solaris fails to call original grep binary
Date: Wed, 24 Jun 2015 11:43:39 -0700
Vladimir Marek wrote:
> $ 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 "$@"

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.




This bug report was last modified 9 years and 357 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.