Re: Loops and pipes

Bart Schaefer <[email protected]> Mon, 3 Aug 2026 15:51:28 -0700
Newsgroups gmane.comp.shells.zsh.devel
Message-ID <CAH+w=7Zh8+dKT7hwyQquZgr=DYzYXKrLs40h_0WOyam+zAT-7Q@mail.gmail.com>
On Mon, Aug 3, 2026 at 3:37=E2=80=AFPM Philippe Altherr
<[email protected]> wrote:
>
> I don't think that trying to make "break" and "continue" work in such a c=
ontext would be a good idea.
>
> ksh works like Zsh ("break" triggers no error and has the same effect as =
"return") but bash signals an error

Making it an error is quite simple:

diff --git a/Src/exec.c b/Src/exec.c
index 5f849db63..2e6684c96 100644
--- a/Src/exec.c
+++ b/Src/exec.c
@@ -1258,6 +1258,7 @@ entersubsh(int flags, struct entersubsh_ret *retp)
        clearjobtab(monitor);
     get_usage();
     forklevel =3D locallevel;
+    loops =3D 0;
 }

 /* execute a string */