diff options
Diffstat (limited to 'shell/hush.c')
-rw-r--r-- | shell/hush.c | 9 |
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, | |||
4930 | end_ch = '}' * 0x100 + '/'; | 4930 | end_ch = '}' * 0x100 + '/'; |
4931 | } | 4931 | } |
4932 | o_addchr(dest, ch); | 4932 | o_addchr(dest, ch); |
4933 | /* The pattern can't be empty. | ||
4934 | * IOW: if the first char after "${v//" is a slash, | ||
4935 | * it does not terminate the pattern - it's the first char of the pattern: | ||
4936 | * v=/dev/ram; echo ${v////-} prints -dev-ram (pattern is "/") | ||
4937 | * v=/dev/ram; echo ${v///r/-} prints /dev-am (pattern is "/r") | ||
4938 | */ | ||
4939 | if (i_peek(input) == '/') { | ||
4940 | o_addchr(dest, i_getch(input)); | ||
4941 | } | ||
4933 | again: | 4942 | again: |
4934 | if (!BB_MMU) | 4943 | if (!BB_MMU) |
4935 | pos = dest->length; | 4944 | pos = dest->length; |