Configuration Information [Automatically generated, do not change]: Machine: x86_64 OS: linux-gnu Compiler: gcc Compilation CFLAGS: -g -O2 uname output: Linux … 5.18.16-…-amd64 #1 SMP PREEMPT_DYNAMIC Debian 5.18.16-… (2022-…) x86_64 GNU/Linux Machine Type: x86_64-pc-linux-gnu
Bash Version: 5.2 Patch Level: !PATCHLEVEL! Release Status: release Description: Some substitutions that used to work pre 5.2 are failing starting in 5.2. I did a git bisect on that, it's the initial 5.2 commit which broke this, https://git.savannah.gnu.org/cgit/bash.git/commit/?h=bash-5.2&id=74091dd4e8086db518b30df7f222691524469998. According to my reproducing example below, this appears to be due to a combination of conditional substitution, a variable enclosed in curly braces and an unbalanced opening square bracket that I think should only be considered as text without any semantic relevance in this position. Repeat-By: bash -c 'x=""; echo "a${x:+${x}[}b"' Work-around: Omit the inner curly braces, i.e. use "a${x:+$x[}b".