From 88c42a2ba0f0baa9fd20bb7abddc2ad89b66a508 Mon Sep 17 00:00:00 2001 From: Peter Stephenson Date: Sun, 30 Oct 2016 17:12:04 +0000 Subject: 39777: $() is a valid empty command substitution --- ChangeLog | 5 +++++ Src/parse.c | 2 +- Test/D08cmdsubst.ztst | 14 ++++++++++++++ 3 files changed, 20 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index c453aee84..e08cafd30 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2016-10-30 Peter Stephenson + + * 39777: Src/parse.c, Test/D08cmdsubst.ztst: $() is a valid + empty command substitution. + 2016-10-29 Barton E. Schaefer * 39758: Src/builtin.c, Src/params.c: revise 39704 to output diff --git a/Src/parse.c b/Src/parse.c index 24b8cd97f..50a0d5f9f 100644 --- a/Src/parse.c +++ b/Src/parse.c @@ -594,7 +594,7 @@ par_event(int endtok) if (tok == ENDINPUT) return 0; if (tok == endtok) - return 0; + return 1; p = ecadd(0); diff --git a/Test/D08cmdsubst.ztst b/Test/D08cmdsubst.ztst index 89e725966..362537349 100644 --- a/Test/D08cmdsubst.ztst +++ b/Test/D08cmdsubst.ztst @@ -153,3 +153,17 @@ eval 'foo echo this just works, OK\?)' 0:backtracking within command string parsing with alias still pending >this just works, OK? + + ( + set errexit + show_nargs() { print $#; } + print a $() b + print c "$()" d + ) +0:Empty $() is a valid empty substitution. +>a b +>c d + + empty=$() && print "'$empty'" +0:Empty $() is a valid assignment +>'' -- cgit 1.4.1