Greg Wooledge <wool...@eeg.ccf.org> writes: > On Fri, Feb 18, 2011 at 10:32:13PM +0100, Peter Hofmann wrote: >> >> $ echo "$(echo "{1..3}")" >> 1 2 3 >> >> Huh? > > Brace expansion is a funny thing. My belief at the moment -- I'm sure > someone will correct me if I'm wrong -- is that because you've got > everything quoted up, it's all seen as one "word" by the parser. And > it's a word that just happens to have a brace expansion in it. So, > the parser expands it out something like this: > > $ echo "$(echo "1")" "$(echo "2")" "$(echo "3")" > > Counting PIDs on my sequentially-generating-PIDs OS seems to confirm that > it's running three child processes, so that lends a tiny bit of evidence > to my theory.
$ set -x $ echo "$(echo "{1..3}")" ++ echo 1 ++ echo 2 ++ echo 3 + echo 1 2 3 1 2 3 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."