$ echo $BASH_VERSION 4.4.12(1)-release $ echo $BASH_VERSION{nobraceexpansion} 4.4.12(1)-release{nobraceexpansion} $ echo ${BASH_VERSION}{brace,expansion} 4.4.12(1)-releasebrace 4.4.12(1)-releaseexpansion $ echo $BASH_VERSION{brace,expansion} => no output. Unexpected $ echo $BASH_VERSIONfoo => no output as expected
Why does $ echo $BASH_VERSION{brace,expansion} produce no output? Comment from braces.c: /* Basic idea: Segregate the text into 3 sections: preamble (stuff before an open brace), postamble (stuff after the matching close brace) and amble (stuff after preamble, and before postamble). Expand amble, and then tack on the expansions to preamble. Expand postamble, and tack on the expansions to the result so far. */ "Expand amble, and then tack on the expansions to preamble.“ made me expect two things: - No expansion of $BASH_VERSION is performed and $BASH_VERSION is used to append the pieces from the expansion of amble - Expansion will be performed like it should be the case, because „{„ is obviously a parameter expansion terminal character as the line $ echo $BASH_VERSION{nobraceexpansion} shows, because this line really does expand $BASH_VERSION