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

Re: anonymous function question

On Mon, Aug 22, 2022 at 10:36 PM Lawrence Velázquez <larryv@zsh.org> wrote:
On Mon, Aug 22, 2022, at 10:11 PM, Jim wrote:
is normal for an anonymous function?

This is not just about anonymous functions.  You can observe the
same behavior with regular functions and other complex commands.


Thanks for responding.

Guess this is what I get for always having interactive_comments set
while in interactive mode. Just assumed it was the way it should work.
You know what they say about assuming. DON'T!

- Comment removal is performed during parsing.  Thus, setting and
  unsetting INTERACTIVE_COMMENTS changes how parsing is done.
- A complex command is parsed *in its entirety* before *any* of its
  commands are executed.  Thus, a command within a complex command
  cannot affect how the rest of the complex command is parsed.

Therefore, a complex command cannot enable or disable comments
within itself.  It can affect subsequent commands, though:
Need to let this sink in a bit.  Having a problem with how 'parsing' takes
place with interactive/complex commands. If this is the case, it is what
it is then.

I don't know whether any of this is explicitly described in the

I did find this. Missed it on previous searches do to the hyphenation.

       In  non-interactive  shells, or in interactive shells with the INTERAC‐
       TIVE_COMMENTS option set, a word beginning with the third character  of
       the  histchars  parameter (`#' by default) causes that word and all the
       following characters up to a newline to be ignored.

Blanket statement for sure. Doesn't get into any detail.



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