>      ${!prefix*}
>      [EMAIL PROTECTED]
>         Expands to the names of variables whose names begin with prefix,
>         separated by the first character of the IFS special variable.
> 
> ---
>  From this, I'd expect both forms to have the same output.
> Is this what is intended and what I should expect?
> 
> For test purposes, I set:
>    IFS="<" OFS=">"   # (also set "Output" FS to see if it is used
>                      #  in the output of 'echo')
> ---
> I used 4 tests, all with prefix=U, 1st pair unquoted, 2nd pair quoted.
> input:
>    echo ' * ' =  ${!U*}    ; \     # (line 1 - * unquoted)
>    echo ' @ ' =  [EMAIL PROTECTED]    ; \     # (line 2 - @ unquoted)
>    echo '"*"' = "${!U*}"   ; \     # (line 3 - * quoted)
>    echo '"@"' = "[EMAIL PROTECTED]"           # (line 4 - @ quoted)
> ---
> 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?

I think adding this sentence to the man page will explain it:

When @ is used and the expansion appears within double quotes, each
variable name expands to a separate word.

Similar language appears in the description of other expansions that
do the same sort of thing (e.g., [EMAIL PROTECTED]). 

> - Why do the quotes in line 3 make for different output than in line
> Why aren't the 4 lines identical?  I see the IFS, "<" in line 3, but
> not in lines 1,2&4.  Why isn't it in all 4 lines and, also, even
> the double quotes make a difference when expanding variables, why
> aren't lines 3&4 the same?

It's not in the first two lines because it's removed as part of word
splitting.  When word splitting is inhibited by double quotes, the
above sentence from the man page will explain the difference in output.

Chet

-- 
``The lyf so short, the craft so long to lerne.'' - Chaucer
                                Live Strong.
Chet Ramey, ITS, CWRU    [EMAIL PROTECTED]    http://tiswww.tis.case.edu/~chet/


_______________________________________________
Bug-bash mailing list
Bug-bash@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-bash

Reply via email to