From 83e434d5b56baccf617ebcc8a752959f7c4aacfc Mon Sep 17 00:00:00 2001 From: Denys Vlasenko Date: Fri, 20 Jul 2018 17:36:06 +0200 Subject: hush: fix handling of '' in ${var:+ARG} This wasn't an ash bug in dollar_altvalue9, it was hush bug (and bash!) function old new delta expand_one_var 2236 2254 +18 expand_vars_to_list 1097 1103 +6 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 2/0 up/down: 24/0) Total: 24 bytes Signed-off-by: Denys Vlasenko --- shell/ash_test/ash-quoting/dollar_altvalue2.tests | 33 +++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100755 shell/ash_test/ash-quoting/dollar_altvalue2.tests (limited to 'shell/ash_test/ash-quoting/dollar_altvalue2.tests') diff --git a/shell/ash_test/ash-quoting/dollar_altvalue2.tests b/shell/ash_test/ash-quoting/dollar_altvalue2.tests new file mode 100755 index 000000000..3377eb27f --- /dev/null +++ b/shell/ash_test/ash-quoting/dollar_altvalue2.tests @@ -0,0 +1,33 @@ +f() { echo start:; for i; do echo "|$i|"; done; echo end; } +x=a + +echo "Unquoted '':" +f ${x:+''} +f ${x:+'' } +f ${x:+ ''} +f ${x:+ '' } +f ${x:+'' ''} + +echo +echo 'Unquoted "":' +f ${x:+""} +f ${x:+"" } +f ${x:+ ""} +f ${x:+ "" } +f ${x:+"" ""} + +echo +echo "Quoted '':" +f "${x:+''}" +f "${x:+'' }" +f "${x:+ ''}" +f "${x:+ '' }" +f "${x:+'' ''}" + +echo +echo 'Quoted "":' +f "${x:+""}" +f "${x:+"" }" +f "${x:+ ""}" +f "${x:+ "" }" +f "${x:+"" ""}" -- cgit v1.2.3