bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: bash tries to parse comsub in quoted PE pattern


From: Emanuele Torre
Subject: Re: bash tries to parse comsub in quoted PE pattern
Date: Sun, 22 Oct 2023 00:40:08 +0200
User-agent: Mutt/2.2.12 (2023-09-09)

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



reply via email to

[Prev in Thread] Current Thread [Next in Thread]