diff options
Diffstat (limited to 'shell/hush.c')
-rw-r--r-- | shell/hush.c | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/shell/hush.c b/shell/hush.c index dddba5e30..4fdd15900 100644 --- a/shell/hush.c +++ b/shell/hush.c | |||
@@ -5994,7 +5994,19 @@ static int encode_then_append_var_plusminus(o_string *output, int n, | |||
5994 | continue; | 5994 | continue; |
5995 | } | 5995 | } |
5996 | #endif | 5996 | #endif |
5997 | o_addQchr(&dest, ch); | 5997 | if (dquoted) { |
5998 | /* Always glob-protect if in dquotes: | ||
5999 | * x=x; echo "${x:+/bin/c*}" - prints: /bin/c* | ||
6000 | * x=x; echo "${x:+"/bin/c*"}" - prints: /bin/c* | ||
6001 | */ | ||
6002 | o_addqchr(&dest, ch); | ||
6003 | } else { | ||
6004 | /* Glob-protect only if char is quoted: | ||
6005 | * x=x; echo ${x:+/bin/c*} - prints many filenames | ||
6006 | * x=x; echo ${x:+"/bin/c*"} - prints: /bin/c* | ||
6007 | */ | ||
6008 | o_addQchr(&dest, ch); | ||
6009 | } | ||
5998 | } /* for (;;) */ | 6010 | } /* for (;;) */ |
5999 | 6011 | ||
6000 | if (dest.data) { | 6012 | if (dest.data) { |