2022年11月4日(金) 2:50 Andreas Schwab <[email protected]>:
> On Nov 03 2022, thierryb--- via Bug reports for the GNU Bourne Again SHell
> wrote:
> > Description:
> > String substitution code running for years is broken in 5.2.
> >
> > Repeat-By:
> > string = 'xdotool type "sudo apt update"'
> > string="${string//\"/"}"
> > printf '%s' "$string"
> >
> > previously outputs:
> > xdotool type "sudo apt update"
> >
> > but now outputs:
> > xdotool type "quot;sudo apt update"quot;
>
> shopt -u patsub_replacement
Another option is to quote `&' in the replacement if you want to make
it work regardless of the 5.2 feature, patsub_replacement:
string="${string//\"/\"}"