summaryrefslogtreecommitdiff
path: root/Src/exec.c
diff options
context:
space:
mode:
authorPeter Stephenson <pws@users.sourceforge.net>2008-09-01 20:18:46 +0000
committerPeter Stephenson <pws@users.sourceforge.net>2008-09-01 20:18:46 +0000
commit1f81bdcb47d42fc72340503eca46eb0a8b64c4ef (patch)
tree6407de32edf43bd93c648590c7abfe4ad2fa1324 /Src/exec.c
parent2c9138bc21145c9680d4d10eea6f5e15e73f479c (diff)
downloadzsh-1f81bdcb47d42fc72340503eca46eb0a8b64c4ef.tar.gz
zsh-1f81bdcb47d42fc72340503eca46eb0a8b64c4ef.zip
25587: fix a==(stuff) and associated stuff.
Diffstat (limited to 'Src/exec.c')
-rw-r--r--Src/exec.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/Src/exec.c b/Src/exec.c
index 06f08ffb8..cf0efed19 100644
--- a/Src/exec.c
+++ b/Src/exec.c
@@ -2220,6 +2220,7 @@ execcmd(Estate state, int input, int output, int how, int last1)
doneps4 = 0;
redir = (wc_code(*state->pc) == WC_REDIR ? ecgetredirs(state) : NULL);
if (wc_code(*state->pc) == WC_ASSIGN) {
+ cmdoutval = 0;
varspc = state->pc;
while (wc_code((code = *state->pc)) == WC_ASSIGN)
state->pc += (WC_ASSIGN_TYPE(code) == WC_ASSIGN_SCALAR ?
@@ -2236,6 +2237,12 @@ execcmd(Estate state, int input, int output, int how, int last1)
* they don't modify their argument strings. */
args = (type == WC_SIMPLE ?
ecgetlist(state, WC_SIMPLE_ARGC(code), EC_DUP, &htok) : NULL);
+ /*
+ * If assignment but no command get the status from variable
+ * assignment.
+ */
+ if (!args && varspc)
+ lastval = errflag ? errflag : cmdoutval;
for (i = 0; i < 10; i++) {
save[i] = -2;