diff options
Diffstat (limited to 'shell')
-rw-r--r-- | shell/ash_test/ash-vars/param_expand_default.right | 2 | ||||
-rwxr-xr-x | shell/ash_test/ash-vars/param_expand_default.tests | 5 | ||||
-rw-r--r-- | shell/hush.c | 6 | ||||
-rw-r--r-- | shell/hush_test/hush-vars/param_expand_default.right | 2 | ||||
-rwxr-xr-x | shell/hush_test/hush-vars/param_expand_default.tests | 5 |
5 files changed, 20 insertions, 0 deletions
diff --git a/shell/ash_test/ash-vars/param_expand_default.right b/shell/ash_test/ash-vars/param_expand_default.right index 3eecd13..7a42f67 100644 --- a/shell/ash_test/ash-vars/param_expand_default.right +++ b/shell/ash_test/ash-vars/param_expand_default.right @@ -5,3 +5,5 @@ _aaaa _aaaa _aaaa _aaaa _aaaa _ _ _ _word _word _ _ _ _ _word _fff _fff _fff _fff _fff +1:1 +0:0 diff --git a/shell/ash_test/ash-vars/param_expand_default.tests b/shell/ash_test/ash-vars/param_expand_default.tests index 5e42d30..b5edfe1 100755 --- a/shell/ash_test/ash-vars/param_expand_default.tests +++ b/shell/ash_test/ash-vars/param_expand_default.tests @@ -21,3 +21,8 @@ echo _$f _${f-} _${f:-} _${f-word} _${f:-word} f=fff echo _$f _${f-} _${f:-} _${f-word} _${f:-word} + +set -- +set -- "${1-}"; echo 1:$# +set -- +set -- ${1-}; echo 0:$# diff --git a/shell/hush.c b/shell/hush.c index b612c80..a103e81 100644 --- a/shell/hush.c +++ b/shell/hush.c @@ -6132,6 +6132,12 @@ static int encode_then_append_var_plusminus(o_string *output, int n, /* string has no special chars * && string has no $IFS chars */ + if (dquoted) { + /* Prints 1 (quoted expansion is a "" word, not nothing): + * set -- "${notexist-}"; echo $# + */ + output->has_quoted_part = 1; + } return expand_vars_to_list(output, n, str); } diff --git a/shell/hush_test/hush-vars/param_expand_default.right b/shell/hush_test/hush-vars/param_expand_default.right index acc7172..dbade30 100644 --- a/shell/hush_test/hush-vars/param_expand_default.right +++ b/shell/hush_test/hush-vars/param_expand_default.right @@ -6,3 +6,5 @@ _aaaa _aaaa _aaaa _aaaa _aaaa _ _ _ _word _word _ _ _ _ _word _fff _fff _fff _fff _fff +1:1 +0:0 diff --git a/shell/hush_test/hush-vars/param_expand_default.tests b/shell/hush_test/hush-vars/param_expand_default.tests index 16e5f8e..754827a 100755 --- a/shell/hush_test/hush-vars/param_expand_default.tests +++ b/shell/hush_test/hush-vars/param_expand_default.tests @@ -22,3 +22,8 @@ echo _$f _${f-} _${f:-} _${f-word} _${f:-word} f=fff echo _$f _${f-} _${f:-} _${f-word} _${f:-word} + +set -- +set -- "${1-}"; echo 1:$# +set -- +set -- ${1-}; echo 0:$# |