Hi, I’ve got the following issue, and… yesssss I can see how the reporter could come to the conclusion that it should “return” 1, but…
… at what point does “continue” “return”? Where do I stop operating? mksh does indeed deviate from all the other shells here, but I’m puzzled how they’d even implement that; mksh in the case of a break or continue unwinds to the enclosing loop, then sets the variable tracking the exit status to 0; the continue command does not rightly return if it executes. If it did, where would we stop? { continue; ls; } && ls || ls I guess I’m asking for a blessing to support my reading that continue may unwind as soon as it executes and that writing “! continue” and expecting the ! to negate the errorlevel if the continue successfully executes is unreasonable. ---------- Forwarded message ---------- From: Oğuz İsmail Uysal <2053...@bugs.launchpad.net> Date: Tue, 13 Feb 2024 17:30:06 -0000 Subject: [Bug 2053053] [NEW] for loop exit status Public bug reported: The following shell script should print 1 according to POSIX: for x in y; do ! continue done echo $? But it prints 0 on mksh ** Affects: mksh Importance: Undecided Status: New -- You received this bug notification because you are a member of mksh Mailing List, which is subscribed to mksh. Matching subscriptions: mkshlist-to-mksh-bugmail https://bugs.launchpad.net/bugs/2053053 Title: for loop exit status Status in mksh: New Bug description: The following shell script should print 1 according to POSIX: for x in y; do ! continue done echo $? But it prints 0 on mksh To manage notifications about this bug go to: https://bugs.launchpad.net/mksh/+bug/2053053/+subscriptions