I noticed a strange issue with some variable replacement text getting replaced in a weird way.
It may be intentional. I just want to understand the differences and if it is, or if its a newer bug. Originally i was doing this to prepend data to an array like "${array_[@]/#/${variable}}" I simplified it down to just string replacement. $ cat replacestring.sh original_string="1|2|3|4" replace_string=':\\' echo "original: ${original_string} replace:${replace_string}" echo "unquoted ${original_string/2/${replace_string}}" echo "quoted ${original_string/2/"${replace_string}"}" GNU bash, version 5.2.37(1)-release (x86_64-pc-linux-gnu) $ bash replacestring.sh original: 1|2|3|4 replace::\\ unquoted 1|:\|3|4 quoted 1|:\\|3|4 on older versions, this was a little different: GNU bash, version 4.1.2(2)-release (x86_64-redhat-linux-gnu) $ bash /tmp/replacestring.sh original: 1|2|3|4 replace::\\ unquoted 1|:\\|3|4 quoted 1|":\\"|3|4 Then, there was an inbetween version: (custom but based on this) GNU bash, version 5.1.16(1)-release (x86_64-pc-linux-musl) original: 1|2|3|4 replace::\\ unquoted 1|:\\|3|4 quoted 1|:\\|3|4 newer versions, unquoted the replacement loses a backslash old version, the quoted version has the quotes as part of the replacement Jeff