[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Brace expansion inside of command substitution - broken or is it me?
From: |
Greg Wooledge |
Subject: |
Re: Brace expansion inside of command substitution - broken or is it me? |
Date: |
Fri, 18 Feb 2011 16:45:19 -0500 |
User-agent: |
Mutt/1.4.2.3i |
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.