bug-grep
[Top][All Lists]
Advanced

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

Re: [bug-grep] bashism in egrep


From: Stepan Kasal
Subject: Re: [bug-grep] bashism in egrep
Date: Thu, 24 Feb 2005 09:43:14 +0100
User-agent: Mutt/1.4.1i

Hi,

On Sat, Feb 19, 2005 at 10:33:21AM -0700, Bob Proulx wrote:
> Han Boetes wrote:
> > egrep contains [...] exec grep -E ${1+"$@"}

> > with zsh as the sh implementation you'll get:
> > egrep 'blah blah' /dev/null
> > egrep: no such file or directory: blah
> 
> Then zsh is not suitable as a /bin/sh replacement.

IIRC, zsh has fixed this.  Try to upgrade to the latest version of zsh,
it might help.

> >   exec grep -E "$@"
> 
> That fails to handle empty arguments properly on many legacy systems.

To be more precise, this mishandles the case when no arguments are given,
on those legacy systems.

What does this mean in our case?  You call "egrep" and instead of the
usage message, you get ... nothing, egrep reads stdin and waits.

I don't think this bug is that important; you almost never call "egrep"
with no parameters from a script.  And when you do it from cmdline, you
can hit ^C after a while.

I have already considered the possibility of replacing ${1+"$@"} with
mere "$@", especially if "separate binaries" becomes the default
method of installation, as proposed before.

The reason is not the zsh bug, of course.  I just don't like having
workarounds in code, if they aren't absolutely necessary.
(Someone could read the script and reproduce the pattern...)

Regards,
        Stepan




reply via email to

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