From cf6b0f5663e798c8d4303697115230ac4469baca Mon Sep 17 00:00:00 2001 From: Peter Stephenson Date: Mon, 29 Sep 2014 21:02:59 +0100 Subject: 33285: apply function definition redirections at execution --- Test/A04redirect.ztst | 38 +++++++++++++++++++++++++++++++++++++- 1 file changed, 37 insertions(+), 1 deletion(-) (limited to 'Test') diff --git a/Test/A04redirect.ztst b/Test/A04redirect.ztst index 7ad02db3b..436ae59cd 100644 --- a/Test/A04redirect.ztst +++ b/Test/A04redirect.ztst @@ -54,7 +54,7 @@ 0:Here-documents stripping tabs >barbar - cat <<-$'$HERE '`$(THERE) `'$((AND)) '"\EVERYWHERE" + cat <<-$'$HERE '`$(THERE) `'$((AND)) '"\EVERYWHERE" # # tabs again. sorry about the max miller. Here's a funny thing. Here is a funny thing. I went home last night. There's a funny thing. @@ -455,3 +455,39 @@ [input1 + () { + local var + read var + print I just read $var + } output1 + print Nothing output yet + cat output1 +0:anonymous function redirections are applied immediately +>Nothing output yet +>I just read any old rubbish + + redirfn() { + local var + read var + print I want to tell you about $var + print Also, this might be an error >&2 + } output2 2>&1 + print something I heard on the radio >input2 + redirfn + print No output until after this + cat output2 +0:redirections with normal function definition +>No output until after this +>I want to tell you about something I heard on the radio +>Also, this might be an error + + which redirfn +0:text output of function with redirections +>redirfn () { +> local var +> read var +> print I want to tell you about $var +> print Also, this might be an error >&2 +>} < input2 > output2 2>&1 -- cgit 1.4.1