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

Loops and pipes



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?




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