bug-bash
[Top][All Lists]
Advanced

[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: Peter Hofmann
Subject: Re: Brace expansion inside of command substitution - broken or is it me?
Date: Sat, 19 Feb 2011 12:13:50 +0100
User-agent: Mutt/1.5.21 (2010-09-15)

Hi,

On Fri, Feb 18, 2011 at 07:26:18PM -0500, Chet Ramey wrote:
> Brace expansion is strictly textual, is performed before all other
> expansions, and doesn't understand a whole lot of shell syntax.
> It does understand a little about quoted strings, so what you get is
> 
> echo "$(echo "1")" "$(echo "2")" "$(echo "3")"
> 
> The preamble is "$(echo ", the portion to be expanded is {1..3}, and the
> postscript is ")".

thank you for clearing that up!

Aha, I see. I've read that part about "strictly textual" and "performed
before all other expansions" in the manual, but I didn't realize all the
consequences. This means that my quotes get interpreted *after* the
brace expansion is done, right? As a result, a call like

 echo "$(echo "{1..3}')'

ends up as

 echo "$(echo "1')' "$(echo "2')' "$(echo "3')'

and that surely won't work.

This makes a lot more sense now.


Thanks again,
Peter



reply via email to

[Prev in Thread] Current Thread [Next in Thread]