On Wed, 5 Jun 2024 23:11:43 +0200, Andreas Grünbacher wrote: > Am Mi., 5. Juni 2024 um 22:57 Uhr schrieb Jean Delvare <jdelv...@suse.de>: > > On Tue, 14 May 2024 14:50:34 +0200, Andreas Grünbacher wrote: > > > Thanks, that's better, but since that's used as a printf format > > > string, shouldn't backslashes also be escaped, like > > > ${prefix//[%\\]/&&}? > > > > Have you tested this? I don't think "&" as a reference to the pattern > > match works in bash pattern substitution the way it does in sed > > substitutions. > > No, I alway commit code completely untested. Here's a "test script": > > prefix='a%b\c'; echo ${prefix//[%\\]/&&}
$ prefix='a%b\c'; echo ${prefix//[%\\]/&&} a&&b&&c $ echo $BASH_VERSION 4.4.23(1)-release So it clearly doesn't work for me. From the CHANGES file, it is a new feature of bash version 5.2: 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 `&'. Quilt currently works with bash versions 3.0 and later, so I'm afraid you'll have to come up with a more portable solution. Thanks, -- Jean Delvare SUSE L3 Support _______________________________________________ Quilt-dev mailing list Quilt-dev@nongnu.org https://lists.nongnu.org/mailman/listinfo/quilt-dev