Loops and pipes
Bart Schaefer <[email protected]> Fri, 31 Jul 2026 14:38:57 -0700
| Newsgroups | gmane.comp.shells.zsh.devel |
|---|---|
| Message-ID | <CAH+w=7aqY8wsSSczg_79gPzeA2zfQA=hLhKhXXnLLgNKK_0GKQ@mail.gmail.com> |
This should have been obvious in retrospect, but it just bit me:
continue and break on the left side of a pipe are useless.
Stupid example:
for x in 1 2 3; do
{ echo $x; false || break } | read -E
done
1
2
3
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? (I have not yet investigated implementation.)
Tangentially:
% continue
continue: not in while, until, select, or repeat loop
Shouldn't that also mention "for" loops?