about summary refs log tree commit diff
path: root/Src/exec.c
diff options
context:
space:
mode:
Diffstat (limited to 'Src/exec.c')
-rw-r--r--Src/exec.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/Src/exec.c b/Src/exec.c
index fb73e124e..7b45a1ba2 100644
--- a/Src/exec.c
+++ b/Src/exec.c
@@ -1661,11 +1661,16 @@ execcmd(Estate state, int input, int output, int how, int last1)
 		    } else if (varspc) {
 			nullexec = 2;
 			break;
-		    } else if (!nullcmd || !*nullcmd ||
-			       (cflags & BINF_PREFIX)) {
+		    } else if (((!nullcmd || !*nullcmd || opts[IGNORENULLCMD])
+				&& !opts[SHNULLCMD]) 
+			       ||(cflags & BINF_PREFIX)) {
 			zerr("redirection with no command", NULL, 0);
 			errflag = lastval = 1;
 			return;
+		    } else if (!nullcmd || !*nullcmd || opts[IGNORENULLCMD]) {
+			if (!args)
+			    args = newlinklist();
+			addlinknode(args, dupstring(":"));
 		    } else if (readnullcmd && *readnullcmd &&
 			       ((Redir) peekfirst(redir))->type == READ &&
 			       !nextnode(firstnode(redir))) {