about summary refs log tree commit diff
diff options
context:
space:
mode:
authorPeter Stephenson <pws@zsh.org>2017-12-12 09:13:41 +0000
committerPeter Stephenson <pws@zsh.org>2017-12-12 09:13:41 +0000
commit97c74dcb0e5a22d57759c15d64eaeab87ba410f1 (patch)
treefbbb043548b3186e91f00f989eb0d54632ee61ae
parent45f3169c51446b10e364eb7d5e2ac0922cbc00a3 (diff)
downloadzsh-97c74dcb0e5a22d57759c15d64eaeab87ba410f1.tar.gz
zsh-97c74dcb0e5a22d57759c15d64eaeab87ba410f1.tar.xz
zsh-97c74dcb0e5a22d57759c15d64eaeab87ba410f1.zip
42110: Fix redirections between variable assignments at start of line
-rw-r--r--ChangeLog5
-rw-r--r--Src/parse.c4
-rw-r--r--Test/A04redirect.ztst7
3 files changed, 16 insertions, 0 deletions
diff --git a/ChangeLog b/ChangeLog
index b99d5e11e..16fcd3f61 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2017-12-12  Peter Stephenson  <p.stephenson@samsung.com>
+
+	* 42110: Src/parse.c, Test/A04redirect.ztst: fix redirection in
+	between variable assignments at start of line.
+
 2017-12-01  Peter Stephenson  <p.stephenson@samsung.com>
 
 	* dana: 42065: Test/B10getopts.ztst: new getopts tests.
diff --git a/Src/parse.c b/Src/parse.c
index 5fe3ebd2c..6af2550df 100644
--- a/Src/parse.c
+++ b/Src/parse.c
@@ -1848,6 +1848,10 @@ par_simple(int *cmplx, int nr)
 	    incmdpos = oldcmdpos;
 	    isnull = 0;
 	    assignments = 1;
+	} else if (IS_REDIROP(tok)) {
+	    *cmplx = c = 1;
+	    nr += par_redir(&r, NULL);
+	    continue;
 	} else
 	    break;
 	zshlex();
diff --git a/Test/A04redirect.ztst b/Test/A04redirect.ztst
index cb82751ce..b8105cf6d 100644
--- a/Test/A04redirect.ztst
+++ b/Test/A04redirect.ztst
@@ -622,3 +622,10 @@
 >FOO
 >HERE
 >}
+
+  a=b 2>/dev/null c=d
+  print $a
+  print $c
+0:Redirect in the middle of assignments
+>b
+>d