2022年11月4日(金) 2:50 Andreas Schwab <sch...@linux-m68k.org>:
> 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//\"/&quot;}"
> >       printf '%s' "$string"
> >
> >       previously outputs:
> >       xdotool type &quot;sudo apt update&quot;
> >
> >       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//\"/\&quot;}"

Reply via email to