bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: incorrect brace expansion when using default values


From: Paul Jarc
Subject: Re: incorrect brace expansion when using default values
Date: Tue, 05 Sep 2006 19:01:14 -0400
User-agent: Gnus/5.110003 (No Gnus v0.3) Emacs/21.4 (gnu/linux)

Mike Frysinger <address@hidden> 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.

> $ 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}".


paul




reply via email to

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