diff options
author | Denys Vlasenko <vda.linux@googlemail.com> | 2017-07-25 14:55:05 +0200 |
---|---|---|
committer | Denys Vlasenko <vda.linux@googlemail.com> | 2017-07-25 14:55:05 +0200 |
commit | 64925384c9cf5e0d986e183577da286bb3207ce7 (patch) | |
tree | 47688edcf2c0d987800968a9e9d85fc2cd0741e5 /shell/hush_test/hush-vars/param_expand_alt.tests | |
parent | 73c47f6c41c97fb452b4747088543f2c2166830a (diff) | |
download | busybox-64925384c9cf5e0d986e183577da286bb3207ce7.tar.gz |
ash: add a few tests from hush-vars/*
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'shell/hush_test/hush-vars/param_expand_alt.tests')
-rwxr-xr-x | shell/hush_test/hush-vars/param_expand_alt.tests | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/shell/hush_test/hush-vars/param_expand_alt.tests b/shell/hush_test/hush-vars/param_expand_alt.tests index 3b646b142..c9c4249af 100755 --- a/shell/hush_test/hush-vars/param_expand_alt.tests +++ b/shell/hush_test/hush-vars/param_expand_alt.tests @@ -1,9 +1,15 @@ -# first try some invalid patterns (do in subshell due to parsing error) -"$THIS_SH" -c 'echo ${+} ; echo moo' -"$THIS_SH" -c 'echo ${:+} ; echo moo' +# First try some invalid patterns. Do in subshell due to parsing error. +# (set argv0 to "SHELL" to avoid "/path/to/shell: blah" in error messages) +"$THIS_SH" -c 'echo ${+} ; echo moo' SHELL +"$THIS_SH" -c 'echo ${:+} ; echo moo' SHELL -# now some funky ones. (bash doesn't accept ${#+}) +# 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 $#). echo _${#+}_ _${#:+}_ +# Forms with non-empty word work as expected in both ash and bash. +echo _${#+z}_ _${#:+z}_ # now some valid ones set -- |