tags:

views:

61

answers:

2

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.

+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
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
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
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
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
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
+2  A: 
  • Using + rather than - causes these flags to be turned off.

Source

mhitza