summary refs log tree commit diff
path: root/Src
diff options
context:
space:
mode:
Diffstat (limited to 'Src')
-rw-r--r--Src/builtin.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/Src/builtin.c b/Src/builtin.c
index 99daf866b..e1378d901 100644
--- a/Src/builtin.c
+++ b/Src/builtin.c
@@ -4717,17 +4717,19 @@ bin_eval(UNUSED(char *nam), char **argv, UNUSED(Options ops), UNUSED(int func))
 
     prog = parse_string(zjoin(argv, ' ', 1));
     if (prog) {
-	lastval = 0;
-
-	execode(prog, 1, 0);
+	if (wc_code(*prog->prog) != WC_LIST) {
+	    /* No code to execute */
+	    lastval = 0;
+	} else {
+	    execode(prog, 1, 0);
 
-	if (errflag)
-	    lastval = errflag;
+	    if (errflag)
+		lastval = errflag;
+	}
     } else {
 	lastval = 1;
     }
 
-
     errflag = 0;
     scriptname = oscriptname;
     ineval = oineval;