bug-bash
[Top][All Lists]
Advanced

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

Re: documentation for ${!prefix*} is misleading


From: Andreas Schwab
Subject: Re: documentation for ${!prefix*} is misleading
Date: Tue, 10 Aug 2010 16:50:48 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.2 (gnu/linux)

Greg Wooledge <wooledg@eeg.ccf.org> writes:

> On Tue, Aug 10, 2010 at 04:15:30PM +0200, Andreas Schwab wrote:
>> Greg Wooledge <wooledg@eeg.ccf.org> writes:
>> 
>> > The 4.1 man page says:
>> >
>> >       ${!prefix*}
>> >       ${!prefix@}
>> >            Names matching prefix.  Expands to the names of variables whose
>> >            names begin with prefix, separated by the first character of the
>> >            IFS special variable.  When @ is used and the expansion appears
>> >            within double quotes, each variable name expands to a separate
>> >            word.
>
>> > Actually, the IFS rule only applies when the "${!prefix*}" is quoted.
>
>> > I believe this is intended behavior (since it matches how $* works),
>> > and that the man page is simply misleading.
>
>> Parameter expansion and word splitting are two separate steps.  The
>> quote above only talks about the former.
>
> Eh?  The quote mentions the special behavior of the @ version, but not
> the special behavior of the * version.

There is no special behaviour of the * version.

> I'd suggest some wording like this:
>
>        ${!prefix*}
>        ${!prefix@}
>             Names matching prefix.  Expands to the names of variables whose
>             names begin with prefix.   When * is used and the expansion
>           appears within double quotes, the names are separated by the
>           first character of the IFS special variable.

This is wrong.  This happens independent of whether it appears within
double quotes.  The quotes only make the difference of whether word
splitting can be applied on the expansion (if word splitting is
considered in the first place, which isn't in the case of a variable
assignment, for example).

Andreas.

-- 
Andreas Schwab, schwab@linux-m68k.org
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."



reply via email to

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