tech-userlevel archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
Re: Next steps for /bin/sh
> That's an interesting possibility
Yes.
> For anyone who can't see from this what James is suggesting (it took me
> a little time to figure it out...) the idea would be, if I am understanding
> correctly, that while executing a function, if "set -e" is in effect, and
> a command is executed in a fashion where the rules do not cause set -e
> to be ignored, then the function should return a failure status immediately,
> and execute no more (of its) commands. That is, the set -e would cause
> a "return $?" rather than "exit $?" in this case.
Thanks for the explanation (I didn't get it before).
This looks extremly elegant and versatile to me.
It would allow you to "catch" the error at any desired nesting level:
Simply calling a function executed in -e context would "raise" an "exception"
(causing the surrounding function to return $?) in -e context, and so on until
finally, the main body would exit $?. Unless, at any desired level, you "catch"
it by examining the return code!
Home |
Main Index |
Thread Index |
Old Index