inappropriate brace expansion in command substitution
From:
Greg Wooledge
Subject:
inappropriate brace expansion in command substitution
Date:
Mon, 16 Jan 2012 14:14:34 -0500
User-agent:
Mutt/1.4.2.3i
Someone in IRC was doing an overly complex command invovling grep "^.{1,8}"
inside a command substitution, and we believe he stumbled upon a bash bug.
I've simplified it down to this:
$ echo "$(echo "a{1,8}")"
a1 a8
The curly braces here should not be treated as a brace expansion, since
they're obviously inside a quoted argument.
This is occurring in every version of bash tested (which includes 2.05b,
3.2.51, 4.0.33, 4.1.9, and 4.2.20).
This slightly different command works as expected:
x="$(echo "a{1,8}")"; echo "$x"
a{1,8}