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

Re: Loops and pipes



On Fri, Jul 31, 2026 at 2:38 PM Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx> wrote:
>
> continue and break on the left side of a pipe are useless.

I see that it's not completely useless.

> Would anyone have an issue with break / continue causing an error if
> either appears in a subshell where the surrounding loop is in the
> parent?

Counter-example:

for x in 1 2 3; do (echo IN $x; break; echo OUT $x); done
IN 1
IN 2
IN 3

It'd take some finagling to get break/continue to propagate up. Hijack
a signal?  Reserve an exit status of the subshell?




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