Greg Wooledge <wool...@eeg.ccf.org> writes: > The 4.1 man page says: > > ${!prefix*} > ${!pre...@} > 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.
The IFS rules are the same as with $* and $...@. > imadev:~$ IFS='+x' > imadev:~$ echo ${!P*} > P4CLIENT PAGER PATH PIPESTATUS PKG_CONFIG_PATH PPID PS1 PS2 PS4 PWD ${!P*} expands to P4CLIENT+PAGER+PATH+... and word splitting splits it on any character in $IFS, which echo receives as separate arguments. Try this to see the difference: $ o=$IFS; IFS=+; a=${!P*}; IFS=$o; echo $a > imadev:~$ echo "${!P*}" > P4CLIENT+PAGER+PATH+PIPESTATUS+PKG_CONFIG_PATH+PPID+PS1+PS2+PS4+PWD "${!P*}" expands to a single word, no word splitting is performed on it. > 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. Andreas. -- Andreas Schwab, sch...@linux-m68k.org GPG Key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5 "And now for something completely different."