[Top][All Lists]

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

Re: problem with egrep and fgrep

From: Eric Backus
Subject: Re: problem with egrep and fgrep
Date: Mon, 13 Sep 2004 15:49:35 -0700

"Paul Jarc" <address@hidden> wrote in message news:address@hidden
address@hidden (Bob Proulx) wrote:
In it the following is suggested as the best method to find a command
on PATH.

That's useful, thanks.

Since 'grep' has no subprocesses it would seem simpler, if that is
what you want to do, to just to set PATH to '@bindir@':$PATH and then
execute grep without trying to locate it first.

Works for me.  Or, if anyone cares about touching the environment,
it's easy enough to check a single directory:

if test -x '@bindir@'/grep
 then exec '@bindir@'/grep -E ${1+"$@"}
 else exec grep -E ${1+"$@"}

But this still breaks an installation that has a non-GNU grep in /usr/bin, mounts a Linux system at /mounts/linux/, and correctly sets PATH to /mounts/linux/usr/bin:/usr/bin. So you break what I would consider a "correct" installation, which worked in the past, in order to make your new installation work.

Frankly, I'd like to see this done with links, in spite of the coding standards. Grep, like "ls", is a historical special case which is more simply handled with links than with various shell-script workarounds. If not links, then we should just go to completely separate copies.

Eric Backus

reply via email to

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