[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [bug-grep] bashism in egrep
From: |
Bob Proulx |
Subject: |
Re: [bug-grep] bashism in egrep |
Date: |
Sat, 19 Feb 2005 10:33:21 -0700 |
User-agent: |
Mutt/1.5.6+20040907i |
Han Boetes wrote:
> egrep contains a bashism:
>
> #!/bin/sh
> exec grep -E ${1+"$@"}
There is no bash specific syntax there. That will run on even very
old shells predating bash.
> 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. Please use a
better implementation. A number of shells are suitable for use as
/bin/sh including GNU bash and BSD sh (a.k.a. ash).
> Possibly
> #!/bin/sh
> exec grep -E "$@"
> is a better solution.
That fails to handle empty arguments properly on many legacy systems.
Bob