On 2006-09-06, Andreas Schwab wrote:
> [EMAIL PROTECTED] (Paul Jarc) writes:
>
>> Mike Frysinger <[EMAIL PROTECTED]> wrote:
>>> this little bit of code doesnt work right:
>>> foo() { echo "${1:-a{b,c}}" ; }

   The first '}' is interpreted as the end of the parameter expansion.

>>
>> Brace expansion happens before parameter expansion (man bash,
>> EXPANSION).
>
> Brace expansion doesn't come into play here, because the braces are
> quoted.

   Quote them, and they do expand:

$ foo() { echo "${1:-"a{b,c}"}" ; }
$ foo
ab ac

   However, there is a problem:

$ foo 1
1 1

   Where is the second '1' coming from?

-- 
   Chris F.A. Johnson                      <http://cfaj.freeshell.org>
   ===================================================================
   Author:
   Shell Scripting Recipes: A Problem-Solution Approach (2005, Apress)


_______________________________________________
Bug-bash mailing list
Bug-bash@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-bash

Reply via email to