-
Notifications
You must be signed in to change notification settings - Fork 31
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
for loop wrong exit status #41
Comments
Can you pinpoint the statements that require that behavior in POSIX? Note that the current behavior is the intended consequence of ba43abb. See https://osdn.net/projects/yash/ticket/46224. |
XCU 2.15 Special Built-in Utilities/continue/EXIT STATUS
XCU 2.9.2 Pipelines/Exit Status
XCU 2.9.4 Compound Commands/The for Loop/Exit Status
That ticket is about
|
Thanks, but I don't think your quotes conclude that your script should print 1 rather than 0. The point is that the negated pipeline does not finish at all, either successfully or unsuccessfully. It just gets aborted without producing any exit status. The situation can be made clearer by rewriting with more compound commands: for x in y; do
if continue; then
false
else
true
fi
done
echo $? The for x in y; do
! {
continue
# This `echo` is never executed as it follows `continue`.
echo oops
# ... which means the end of the `{ ... }` command is never reached.
}
# ... which means the end of the enclosing `! ...` command is never reached.
done
echo $? Since the end of the |
Is this what POSIX says or what yash does? |
That's my interpretation of POSIX, and what yash does. |
The following shell script should print 1 according to POSIX:
But it prints 0 on yash.
The text was updated successfully, but these errors were encountered: