On Tuesday 05 September 2006 19:01, Paul Jarc wrote: > Mike Frysinger <[EMAIL PROTECTED]> wrote: > > this little bit of code doesnt work right: > > foo() { echo "${1:-a{b,c}}" ; } > > Brace expansion happens before parameter expansion (man bash, > EXPANSION). So the first "}" ends the parameter expression, and the > second "}" isn't special. The result of parameter expansion is not > subject to brace expansion.
i dont think order is why it's behaving differently from what i expect ... after all, if brace expansion happened before the parameter expansion, it should have assigned "ab ac" as the default value, not "a{b," i think this little tidbit is what matters: Parameter Expansion When braces are used, the matching ending brace is the first `}' not escaped by a backslash or within a quoted string, and not within an embedded arithmetic expansion, command substitution, or parameter expansion. since brace expansion is not listed here as an exception, the behavior i'm seeing is correct > > $ foo > > a{b,c} > > This is correct. "a{b,c" is the default value, and "}" follows the > parameter expression. > > > $ foo 1 > > a} > > I get "1}". sorry, yes this is what i get ... i was hand typing the e-mail ;) -mike
pgpECk7gMRSkd.pgp
Description: PGP signature
_______________________________________________ Bug-bash mailing list Bug-bash@gnu.org http://lists.gnu.org/mailman/listinfo/bug-bash