[Top][All Lists]

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

Re: [bug-grep] egrep and fgrep script assume path

From: Stepan Kasal
Subject: Re: [bug-grep] egrep and fgrep script assume path
Date: Wed, 26 Jan 2005 15:42:01 +0100
User-agent: Mutt/1.4.1i

Hello Joe,

On Tue, Jan 25, 2005 at 01:19:01PM -0800, Joe Weening wrote:
> #!/bin/sh
> exec grep -E ${1+"$@"}

> This makes the assumption that the shell will find GNU grep in its
> path.  In our case, GNU grep is installed in /usr/local/gnu/bin.
> If this directory is not in the path, and someone explicitly runs
> /usr/local/gnu/bin/egrep, then the script runs /usr/bin/grep which
> does not understand the -E and -F options.

thank you for the bug report.  The issue has been already fixed in the
CVS, so that the egrep script now looks like this:

case $0 in
  */*) dir=${0%/*}/ ;;
  *) dir="" ;;
exec ${dir}grep -E ${1+"$@"}

> A fix would be to hardcode the path to GNU grep in the scripts.

There is much grieve about hardcore paths.  The above code supposes that
GNU grep in installed in the same directory as the script, but you can
move all of them, or export the directory.

Have a nice day,
        Stepan Kasal

reply via email to

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