bug-grep
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


From: Paul Eggert
Subject: bug#20883: egrep on Solaris fails to call original grep binary
Date: Wed, 24 Jun 2015 11:43:39 -0700
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.7.0

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.





reply via email to

[Prev in Thread] Current Thread [Next in Thread]