On 27/04/2024 12:02, Herbert Xu wrote:
Naked backslashes in patterns may incorrectly unquote subsequent wild characters that are themselves quoted. Fix this by adding an extra backslash when necessary. Test case: a="\\*bc"; b="\\"; c="*"; echo "<${a##$b"$c"}>" Old result: <> New result: <bc>
The correct result here, I believe, is <\*bc>. The backslash means the next character is taken as literal, even if that character is already also taken as literal because of the quoting. There is nothing to cause the backslash to be taken literally. The result should be that only a leading * is removed from $a.
Cheers, Harald van Dijk