bug-gnu-utils
[Top][All Lists]
Advanced

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

Re: problem with egrep and fgrep


From: Eli Zaretskii
Subject: Re: problem with egrep and fgrep
Date: Mon, 13 Sep 2004 23:02:00 +0300

> Date: Mon, 13 Sep 2004 13:48:10 -0600
> From: address@hidden (Bob Proulx)
> 
> 'which'!  That opens another Pandora's box of problems.

Agreed.

> In it the following is suggested as the best method to find a command
> on PATH.
> 
>      pathfind() {
>          OLDIFS="$IFS"
>          IFS=:
>          for p in $PATH; do
>              if [ -x "$p/$*" ]; then
>                  IFS="$OLDIFS"
>                  return 0
>              fi
>          done
>          IFS="$OLDIFS"
>          return 1
>      }
> 
> > case $grep in
> >   /*) exec "$grep" -E ${1+"$@"};;
> >   *) echo "$grep" >&2 && exit 2;;
> > esac
> 
> 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.

Is this really worth the hassle?  I think it's much easier to just
have another binary called fgrep, and be done with that.  What's
another 250KB on today's huge disks?  I think the time all of you
invested into this discussion costs much more than the dollar
equivalent of 250KB.




reply via email to

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