[Help-bash] Seemingly malformed but sane looking Bashism
From:
Rhys Ulerich
Subject:
[Help-bash] Seemingly malformed but sane looking Bashism
Date:
Tue, 2 Jun 2015 19:30:36 -0400
Bash says...
$ echo ${foo:-$(echo a{b,c})}
bash: syntax error near unexpected token `)'
$ echo $BASH_VERSION
4.3.30(1)-release
..but to me, that looks well-formed:
$ echo ${foo:-default}
default
$ echo ${foo:-$(echo default)}
default
$ echo a{b,c}
ab ac
Is this a bug in the parser?
Coworkers have pointed out that these work as expected:
$ echo ${foo-`echo a{b,c}`}
ab ac
$ echo ${foo:-"$(echo a{b,c})"}
ab ac
- Rhys