Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: Unterminated for loop
- X-seq: zsh-users 29084
- From: Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>
- To: Zsh Users <zsh-users@xxxxxxx>
- Subject: Re: Unterminated for loop
- Date: Tue, 6 Jun 2023 19:58:46 -0700
- Archived-at: <https://zsh.org/users/29084>
- In-reply-to: <CAHYJk3QzE7u_VkPWe3jScz-yRDaDVJ-Dk20xFtMH=7H1JaKAPw@mail.gmail.com>
- List-id: <zsh-users.zsh.org>
- References: <CAN=4vMoM64ZT3uJ2iSndERUKdcyt5cyU8tEshF76HjYhUznBsg@mail.gmail.com> <CAHYJk3QzE7u_VkPWe3jScz-yRDaDVJ-Dk20xFtMH=7H1JaKAPw@mail.gmail.com>
On Tue, Jun 6, 2023 at 4:12 PM Mikael Magnusson <mikachu@xxxxxxxxx> wrote:
>
> On 6/6/23, Roman Perepelitsa <roman.perepelitsa@xxxxxxxxx> wrote:
> > If I type `for x;` (without the quotes) and press ENTER in an interactive
> > zsh, I end up in PS2. However, the exact same sequence of characters is
> > treated as a complete command in a script or function. Why is that?
>
> It is accepted because SHORT_LOOPS is unfortunately set by default,
> which tends to hide a lot of syntax errors in various contexts. It's
> no surprise that it causes weird differences with script EOF vs
> accepting a single line interactively.
Tangentially, this points out that there is no way to send an EOF at
the PS2 prompt (or, likely, at any prompt other than PS1); typing
ctrl+d just lists file completions. Even changing stty eof doesn't
work. Nor does a custom widget that closes FD 0.
Someone please remind me what this sentence under IGNORE_EOF means?
Also, if this option is set and the Zsh Line Editor is used,
widgets implemented by shell functions can be bound to EOF
(normally Control-D) without printing the normal warning message.
I guess "bound to EOF" means overriding the stty EOF character.
What's the significance of the part about the warning message?
Messages sorted by:
Reverse Date,
Date,
Thread,
Author