On Thu, Oct 19, 2023 at 04:12:16PM -0400, Chet Ramey wrote: > On 10/18/23 1:08 PM, Emanuele Torre wrote: > > While we are at it, when examining this issue now, I have also noticed > > that, regardless of whether brace expansion is enabled or not, the bash > > parser always reads single quotes in double quoted PEs as if they are > > not literal, even though they are literal if the PE is -, =, or +. > [...] > > Could/Should this also be fixed so that "${foo:-'}" (and +, and =) is > > read correctly? Other shells including ksh93, mksh, dash, NetBSD ash, > > and busybox can read it correctly. > > It behaves as you want in posix mode. Here's the comment explaning it: > > /* The big hammer. Single quotes aren't special in double quotes. The > problem is that Posix used to say the single quotes are semi-special: > within a double-quoted ${...} construct "an even number of > unescaped double-quotes or single-quotes, if any, shall occur." */ > /* This was changed in Austin Group Interp 221 */ > > Bash in default mode uses its historical behavior, which is what POSIX > originally specified.
Hmm, interesting. I did not know that. Thank you! o/ emanuele6