* Linda W <[EMAIL PROTECTED]> [061106 00:11]: > The manpages for "my" bash's (3.1.11 on Linux and 3.1.17 on cygwin/i686), > under Parameter Expansion, has: > > > ${!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? > - 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? > >
As Yakov pointed out, this is the wrong list, but I will answer anyway. ${!prefix*} and [EMAIL PROTECTED] (unquoted) are the same. However, inside double quotes, "${!prefix*}" expands to a single word (and requires IFS separation between the names that match the prefix), while "[EMAIL PROTECTED]" expands to one word for each name that matches, and hence is already separated by quoting. I do not see this described in the man page under ${!prefix*}, but if you look earlier in the man page under Special Parameters, it describes the difference between $* and [EMAIL PROTECTED] Also, under Arrays (between Special Parameters and Parameter Expansion), it says that the difference between ${name[*]} and [EMAIL PROTECTED] is analogous to the difference between $* and $@, so I imagine that the same applies to !prefix. ...Marvin