After enter set -e
in an interactive bash, bash will exit immediately if any command exits with non-zero. How can I undo this effect? Thanks.
views:
61answers:
2
+3
Q:
Bash: How to undo the effect of "set -e" which makes bash exit immediately if any command fails
+6
A:
With set +e
. Yeah, it's backward that you enable shell options with set -
and disable them with set +
. Historical raisins, donchanow.
Zack
2010-08-18 22:17:06
Thank you very much, it's among the very last lines of corresponding manual page (http://www.faqs.org/docs/bashman/bashref_56.html) which I didn't read to the end.
Tianyi Cui
2010-08-18 22:22:17
The bash manual is dauntingly huge, it is true. (FYI, since you seem to be new: it is the done thing to click the check mark under the best answer to your question, this is called "accepting" it.)
Zack
2010-08-18 22:26:53
And the format `set [--abefhkmnptuvxBCHP] [-o option] [argument ...]` is really misleading. I simply assumed the undo is done by another builtin, tried unset and got nothing. It's interesting that in bash `set` and `unset` are not opposite, while I admit I currently know little about bash programming.
Tianyi Cui
2010-08-18 22:29:08
Sadly, the Unix shell language (most of which is not specific to 'bash') is one of the least internally consistent programming languages still in wide use today. You're going to have to learn lots more of these little warts. And I'd say that's a documentation bug, there.
Zack
2010-08-18 22:36:24
When I was about to report this documentation bug to GNU, I found that the bash manual hosted in faqs.org is last updated 13 November 2001... This bug is actually non-existent in current manual. But faqs.org's SEO seems better so I was mislead. I'll report it to faqs.org then.
Tianyi Cui
2010-08-20 09:07:18