diff options
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 -- |