summaryrefslogtreecommitdiff
path: root/Src/exec.c
diff options
context:
space:
mode:
Diffstat (limited to 'Src/exec.c')
-rw-r--r--Src/exec.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/Src/exec.c b/Src/exec.c
index fb1433764..8c2124c43 100644
--- a/Src/exec.c
+++ b/Src/exec.c
@@ -3187,7 +3187,13 @@ execcond(Estate state, UNUSED(int do_exec))
tracingcond++;
}
cmdpush(CS_COND);
- stat = !evalcond(state);
+ stat = evalcond(state, NULL);
+ /*
+ * 2 indicates a syntax error. For compatibility, turn this
+ * into a shell error.
+ */
+ if (stat == 2)
+ errflag = 1;
cmdpop();
if (isset(XTRACE)) {
fprintf(xtrerr, " ]]\n");