Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: Comment (# char) behavior in the sub-shell



On Sep 20,  6:54pm, Stanislav Seletskiy wrote:
}
} I'm using your patch and it works great.
} 
} Is there chance it will be merged into upstream? I really miss that
} functionality.

Here's an updated patch with a NEWS file entry.


diff --git a/NEWS b/NEWS
index 6847350..796a2c9 100644
--- a/NEWS
+++ b/NEWS
@@ -4,6 +4,14 @@ CHANGES FROM PREVIOUS VERSIONS OF ZSH
 
 Note also the list of incompatibilities in the README file.
 
+Changes from 5.4 to 5.4.3
+-------------------------
+
+The effect of the NO_INTERACTIVE_COMMENTS option extends into $(...) and
+`...` command substitutions when used on the command line.  Previously,
+comments were always recognized within command substitutions unless the
+comment character "#" was disabled via reset of $histchars.
+
 Changes from 5.3.1 to 5.4
 -------------------------
 
diff --git a/Src/exec.c b/Src/exec.c
index d136766..31edfab 100644
--- a/Src/exec.c
+++ b/Src/exec.c
@@ -4509,7 +4509,12 @@ getoutput(char *cmd, int qt)
     pid_t pid;
     char *s;
 
-    if (!(prog = parse_string(cmd, 0)))
+    int onc = nocomments;
+    nocomments = (interact && unset(INTERACTIVECOMMENTS));
+    prog = parse_string(cmd, 0);
+    nocomments = onc;
+
+    if (!prog)
 	return NULL;
 
     if ((s = simple_redir_name(prog, REDIR_READ))) {



Messages sorted by: Reverse Date, Date, Thread, Author