aboutsummaryrefslogtreecommitdiff
path: root/shell/hush.c
diff options
context:
space:
mode:
Diffstat (limited to 'shell/hush.c')
-rw-r--r--shell/hush.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/shell/hush.c b/shell/hush.c
index 6852b5f79..3407711cd 100644
--- a/shell/hush.c
+++ b/shell/hush.c
@@ -4930,6 +4930,15 @@ static int parse_dollar(o_string *as_string,
end_ch = '}' * 0x100 + '/';
}
o_addchr(dest, ch);
+ /* The pattern can't be empty.
+ * IOW: if the first char after "${v//" is a slash,
+ * it does not terminate the pattern - it's the first char of the pattern:
+ * v=/dev/ram; echo ${v////-} prints -dev-ram (pattern is "/")
+ * v=/dev/ram; echo ${v///r/-} prints /dev-am (pattern is "/r")
+ */
+ if (i_peek(input) == '/') {
+ o_addchr(dest, i_getch(input));
+ }
again:
if (!BB_MMU)
pos = dest->length;