bug-bash
[Top][All Lists]
Advanced

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

Re: Expansion of ${!x*} and ${!x@}


From: Chet Ramey
Subject: Re: Expansion of ${!x*} and ${!x@}
Date: Wed, 08 Nov 2006 09:34:48 -0500
User-agent: Thunderbird 1.5.0.7 (Macintosh/20060909)

Matthew Woehlke wrote:
> Linda Walsh wrote:
>> The manpages for "my" bash's (3.1.11 on Linux and 3.1.17 on cygwin/i686),
>> under Parameter Expansion, say:
>>
>>
>>     ${!prefix*}
>>     ${!prefix@}
>>        Expands to the names of variables whose names begin with prefix,
>>        separated by the first character of the IFS special variable.
>>
>> [snip]
>> output:
>>    *  = UID USER                  # (line 1)
>>    @  = UID USER                  # (line 2)
>>   "*" = UID<USER                  # (line 3)
>>   "@" = UID USER                  # (line 4)
>> ---
>>
>> QUESTIONS continued...
>> - If the two forms are supposed to be identical, why aren't lines
>>   3 & 4 the same?
>> - Why do the quotes in line 3 make for different output than in line
>> Why aren't the 4 lines identical?
> 
> I would assume that this works the same as other uses of * and @; if you
> quote them, * expands to a single Word, while @ expands to a Word for
> each logical element (so that any spaces in each element are preserved).
> Similar to how if your argv is 'foo' 'bar none', "$*" gives the single
> Word 'foo bar none' and "$@" gives { 'foo', 'bar none' }.

Matthew is correct; that is how they work.

Chet
-- 
``The lyf so short, the craft so long to lerne.'' - Chaucer
                       Live Strong.  No day but today.
Chet Ramey, ITS, CWRU    chet@case.edu    http://cnswww.cns.cwru.edu/~chet/




reply via email to

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