I'd like to run a series of tasks, but stop should any of them fail, hence I've written (something like):
for task in [TASKS]; do
process "$task" || break
commit "$task"
done
This works fine, but (as specified) the exit status of this loop is zero even if we break early. Ideally break-ing would be able to convey the failure.
I know returning 0 is the documented behavior of break, but I'm curious if there are any relatively clean workarounds. The best I can imagine is wrapping this in a function and setting a didBreak variable, and using that as the exit status (of the function). It'd work, but it feels overly-complex.