Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: egrep with zsh as /bin/sh - wordsplitting



On Thu, Jan 13, 2005 at 09:50:18PM +0100, Michael Prokop wrote:

> Why does the original egrep version use ${1+"$@"} and not
> "$@" or "${1+"$@"}"?

My understanding is that if you write "$@", then with no arguments, in some
shells it becomes "" (i.e., an argument, but with no length), and that's
not actually what you want.  ${1+"$@"} only adds something if there are any
arguments.

I don't know if this is a problem on any modern shell, though.

Danek



Messages sorted by: Reverse Date, Date, Thread, Author