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

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



On Sun, 10 Sep 2017 15:27:11 -0700
Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx> wrote:
> Still:
> 
> torch% echo $(echo $options[interactive])
> on
> torch% 
> 
> so one might ask why no_interactive_comments does not apply.

For the record, it's this complicated test below.  If this evaluates to
true we strip comments.

    if (c == hashchar && !nocomments &&
	(isset(INTERACTIVECOMMENTS) ||
	 ((!lexflags || (lexflags & LEXFLAGS_COMMENTS)) && !expanding &&
	  (!interact || unset(SHINSTDIN) || strin)))) {

The difference between the first and second times through the $(...)
expansion is the second time "strin" is true.

Your patch could possibly do the right thing, as it hits the simpler
part of the test and shouldn't affect behaviour other than comments, so
it might be worth trying for now.

pws



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