function old new delta subevalvar 1576 1588 +12 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
@@ -7073,6 +7073,11 @@ subevalvar(char *start, char *str, int strloc,
repl = NULL;
break;
}
+ /* Skip over quoted 'str'. Example: ${var/'/'} - second / is not a separator */
+ if ((unsigned char)*repl == CTLQUOTEMARK) {
+ while ((unsigned char)*++repl != CTLQUOTEMARK)
+ continue;
+ }
if (*repl == '/') {
*repl = '\0';
@@ -0,0 +1,4 @@
+axxb
@@ -0,0 +1,8 @@
+v="x/x"
+# The second / is quoted, should not be treated as separator
+echo a${v/'/'}b
+# The second / is escaped, should not be treated as separator
+echo a${v/\/}b
+
+echo "a${v/'/'}b"
+echo "a${v/\/}b"