diff options
author | Denys Vlasenko <vda.linux@googlemail.com> | 2017-07-26 00:30:02 +0200 |
---|---|---|
committer | Denys Vlasenko <vda.linux@googlemail.com> | 2017-07-26 00:30:02 +0200 |
commit | b0648b0e7874e8551df64708532346a049ab7f2c (patch) | |
tree | c70d819fe4a2ccae0fe4573d3a2f8fc038af9f04 | |
parent | 2093ad296f8a4528ad0e106b52074871a2bf070e (diff) | |
download | busybox-w32-b0648b0e7874e8551df64708532346a049ab7f2c.tar.gz busybox-w32-b0648b0e7874e8551df64708532346a049ab7f2c.tar.bz2 busybox-w32-b0648b0e7874e8551df64708532346a049ab7f2c.zip |
shell: remove ${#+} tests, it is not a valid construct
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
-rw-r--r-- | shell/ash_test/ash-vars/param_expand_alt.right | 2 | ||||
-rwxr-xr-x | shell/ash_test/ash-vars/param_expand_alt.tests | 9 | ||||
-rw-r--r-- | shell/hush_test/hush-vars/param_expand_alt.right | 2 | ||||
-rwxr-xr-x | shell/hush_test/hush-vars/param_expand_alt.tests | 9 |
4 files changed, 16 insertions, 6 deletions
diff --git a/shell/ash_test/ash-vars/param_expand_alt.right b/shell/ash_test/ash-vars/param_expand_alt.right index c733c147a..1303f8064 100644 --- a/shell/ash_test/ash-vars/param_expand_alt.right +++ b/shell/ash_test/ash-vars/param_expand_alt.right | |||
@@ -1,6 +1,6 @@ | |||
1 | SHELL: line 1: syntax error: bad substitution | 1 | SHELL: line 1: syntax error: bad substitution |
2 | SHELL: line 1: syntax error: bad substitution | 2 | SHELL: line 1: syntax error: bad substitution |
3 | _0_ __ | 3 | __ |
4 | _z_ _z_ | 4 | _z_ _z_ |
5 | _ _ _ _ _ | 5 | _ _ _ _ _ |
6 | _aaaa _ _ _word _word | 6 | _aaaa _ _ _word _word |
diff --git a/shell/ash_test/ash-vars/param_expand_alt.tests b/shell/ash_test/ash-vars/param_expand_alt.tests index d80452434..23e9a26be 100755 --- a/shell/ash_test/ash-vars/param_expand_alt.tests +++ b/shell/ash_test/ash-vars/param_expand_alt.tests | |||
@@ -6,8 +6,13 @@ | |||
6 | # now some funky ones. | 6 | # now some funky ones. |
7 | # ${V+word} "if V unset, then substitute nothing, else substitute word" | 7 | # ${V+word} "if V unset, then substitute nothing, else substitute word" |
8 | # ${V:+word} "if V unset or '', then substitute nothing, else substitute word" | 8 | # ${V:+word} "if V unset or '', then substitute nothing, else substitute word" |
9 | # bash doesn't accept ${#+}. ash prints 0 (not $#): "len of $+" | 9 | # |
10 | echo _${#+}_ _${#:+}_ | 10 | # ${#:+} is a :+ op on $#, but ${#+} (and any other ${#c}) is "length of $c", |
11 | # not + op on $#. | ||
12 | # bash and dash do not accept ${#+}. it's possible for some shell to skip | ||
13 | # the check that c is valid and interpret ${#+} as "len of $+". Not testing it. | ||
14 | # echo _${#+}_ | ||
15 | echo _${#:+}_ | ||
11 | # Forms with non-empty word work as expected in both ash and bash. | 16 | # Forms with non-empty word work as expected in both ash and bash. |
12 | echo _${#+z}_ _${#:+z}_ | 17 | echo _${#+z}_ _${#:+z}_ |
13 | 18 | ||
diff --git a/shell/hush_test/hush-vars/param_expand_alt.right b/shell/hush_test/hush-vars/param_expand_alt.right index 4f9eb2907..c46786e1f 100644 --- a/shell/hush_test/hush-vars/param_expand_alt.right +++ b/shell/hush_test/hush-vars/param_expand_alt.right | |||
@@ -1,6 +1,6 @@ | |||
1 | hush: syntax error: unterminated ${name} | 1 | hush: syntax error: unterminated ${name} |
2 | hush: syntax error: unterminated ${name} | 2 | hush: syntax error: unterminated ${name} |
3 | __ __ | 3 | __ |
4 | _z_ _z_ | 4 | _z_ _z_ |
5 | _ _ _ _ _ | 5 | _ _ _ _ _ |
6 | _aaaa _ _ _word _word | 6 | _aaaa _ _ _word _word |
diff --git a/shell/hush_test/hush-vars/param_expand_alt.tests b/shell/hush_test/hush-vars/param_expand_alt.tests index d80452434..23e9a26be 100755 --- a/shell/hush_test/hush-vars/param_expand_alt.tests +++ b/shell/hush_test/hush-vars/param_expand_alt.tests | |||
@@ -6,8 +6,13 @@ | |||
6 | # now some funky ones. | 6 | # now some funky ones. |
7 | # ${V+word} "if V unset, then substitute nothing, else substitute word" | 7 | # ${V+word} "if V unset, then substitute nothing, else substitute word" |
8 | # ${V:+word} "if V unset or '', then substitute nothing, else substitute word" | 8 | # ${V:+word} "if V unset or '', then substitute nothing, else substitute word" |
9 | # bash doesn't accept ${#+}. ash prints 0 (not $#): "len of $+" | 9 | # |
10 | echo _${#+}_ _${#:+}_ | 10 | # ${#:+} is a :+ op on $#, but ${#+} (and any other ${#c}) is "length of $c", |
11 | # not + op on $#. | ||
12 | # bash and dash do not accept ${#+}. it's possible for some shell to skip | ||
13 | # the check that c is valid and interpret ${#+} as "len of $+". Not testing it. | ||
14 | # echo _${#+}_ | ||
15 | echo _${#:+}_ | ||
11 | # Forms with non-empty word work as expected in both ash and bash. | 16 | # Forms with non-empty word work as expected in both ash and bash. |
12 | echo _${#+z}_ _${#:+z}_ | 17 | echo _${#+z}_ _${#:+z}_ |
13 | 18 | ||