Re: dash bug which is affecting release goal
On 2/24/08, William Pitcock <nenolod@sacredspiral.co.uk> wrote:
> On Sun, 2008-02-24 at 14:00 +0000, Ian Jackson wrote:
> > John H. Robinson, IV writes ("Re: dash bug which is affecting release goal"):
> > > Pierre Habouzit wrote:
> > > > echo() { /bin/echo "$@" }
> > >
> > > echo() { /bin/echo ${1+"$@"}; }
> > >
> > > I believe you mean.
> >
> > Why ?!
>
>
> Because stand-alone $@ is undefined when used in this case. By using ${1
> +"$@"}, it is ensured that $@ always starts with $1.
Expression ${1+"$@"} means "if $1 exists use "$@", otherwise nothing".
It's a workaround for a bug in some old bash version which erroneously
converted "$@" in case of empty command line into a single empty
argument. I think in new releases it isn't necessary to account for
this.
--
Sergei Golovan
Reply to: