From b0648b0e7874e8551df64708532346a049ab7f2c Mon Sep 17 00:00:00 2001 From: Denys Vlasenko Date: Wed, 26 Jul 2017 00:30:02 +0200 Subject: shell: remove ${#+} tests, it is not a valid construct Signed-off-by: Denys Vlasenko --- shell/hush_test/hush-vars/param_expand_alt.right | 2 +- shell/hush_test/hush-vars/param_expand_alt.tests | 9 +++++++-- 2 files changed, 8 insertions(+), 3 deletions(-) (limited to 'shell/hush_test/hush-vars') 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 @@ hush: syntax error: unterminated ${name} hush: syntax error: unterminated ${name} -__ __ +__ _z_ _z_ _ _ _ _ _ _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 @@ # now some funky ones. # ${V+word} "if V unset, then substitute nothing, else substitute word" # ${V:+word} "if V unset or '', then substitute nothing, else substitute word" -# bash doesn't accept ${#+}. ash prints 0 (not $#): "len of $+" -echo _${#+}_ _${#:+}_ +# +# ${#:+} is a :+ op on $#, but ${#+} (and any other ${#c}) is "length of $c", +# not + op on $#. +# bash and dash do not accept ${#+}. it's possible for some shell to skip +# the check that c is valid and interpret ${#+} as "len of $+". Not testing it. +# echo _${#+}_ +echo _${#:+}_ # Forms with non-empty word work as expected in both ash and bash. echo _${#+z}_ _${#:+z}_ -- cgit v1.2.3