[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 17:50:06 +0100
User-agent: Mutt/1.4.1i

Hi Paul,

On Wed, Jan 26, 2005 at 11:07:41AM -0500, Paul Jarc wrote:
> Stepan Kasal <address@hidden> wrote:
> >   */*) dir=${0%/*}/ ;;
> Solaris /bin/sh doesn't handle advanced expansions like that.  I'd
> suggest:

your solution requires one more process, and ${..%..} is required by
Autoconf manual warns that not all hosts have dirname, even though it
doesn't mention any OS.  This claim could be still true.

What does Solaris do with  ${0%/*} ?  I hope it expands to an empty string.

So I propose something like

case $0 in
  */*) dir=${0%/*}/
        case $dir in
        / ) dir=`dirname "$0" 2>/dev/null`
            test "x$dir" != x && dir=$dir/
  *) dir="" ;;
exec "${dir}"grep -E ${1+"$@"}

Would you be so kind to debug this script on Solaris?

And I don't think we need to care about the special case when the script
is installed at the root.  Double slash shouldn't hurt.

With kind regards,

reply via email to

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