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

Re: bug report: INTERACTIVECOMMENTS option interacts oddly with shell functions in an interactive context



2021-09-01 11:09:33 -0700, Bart Schaefer:
> On Wed, Sep 1, 2021 at 8:18 AM Peter Stephenson
> <p.w.stephenson@xxxxxxxxxxxx> wrote:
> >
> > Yes, that does seem pretty clear.  Looks easy to fix and test.
> 
> I'm not sure it's actually all that clear.  Consider the original case:
> 
> % alias '#x'='echo The X Factor'
> % source =(<<<'echo $(
> #x is not a comment
> )')
> The X Factor is not a comment
[...]

That's sourcing a script, same as source =(sed '/end/,$d' script)
so the stripping of comments should take precendence here IMO.

Note that zsh still strips comments in

$ cat =(echo foo # comment)
foo

$ eval 'echo foo # comment'
foo

I wonder what the original intention was for not honouring
comments when run interactively. That doesn't sound useful to
me. Was that to mimic csh?

I find that much annoying when copy-pasting code at the prompt.

It feels wrong to break the shell syntax to accomodate weird use
cases.

-- 
Stephane




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