[Top][All Lists]

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

Re: string substitution broken since 5.2

From: Chet Ramey
Subject: Re: string substitution broken since 5.2
Date: Thu, 3 Nov 2022 14:50:00 -0400
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:102.0) Gecko/20100101 Thunderbird/102.4.0

On 11/3/22 1:32 PM, thierryb--- via Bug reports for the GNU Bourne Again SHell wrote:

Bash Version: 5.2
Patch Level: 2
Release Status: release

        String substitution code running for years is broken in 5.2.

        string = 'xdotool type "sudo apt update"'
        printf '%s' "$string"

        previously outputs:
        xdotool type "sudo apt update"

        but now outputs:
        xdotool type "quot;sudo apt update"quot;

From NEWS:

x. New shell option: patsub_replacement. When enabled, a `&' in the replacement
   string of the pattern substitution expansion is replaced by the portion of
   the string that matched the pattern. Backslash will escape the `&' and
   insert a literal `&'.

The option is enabled by default. If you want to restore the previous
behavior, add `shopt -u patsub_replacement'.

``The lyf so short, the craft so long to lerne.'' - Chaucer
                 ``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, UTech, CWRU    chet@case.edu    http://tiswww.cwru.edu/~chet/

reply via email to

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