Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

2
  • "The philosophy of set -e is typically that it only exits upon uncaught errors. Here, the presence of || outside the subshell seems to tell the shell that the error inside the subshell is 'caught' and therefore set -e does not cause an exit after false." Yes, but the error inside the subshell is not reported. "false1" is not printed. It just masks the error, as if set -e was not in effect at all. Commented Jul 17, 2018 at 17:49
  • You appear to be talking about the case ( set -e; false ; true ) || echo false1. The subshell exits with the return code of the last command run. Since || suppresses the the exit after false, the last command executed in the subshell is true. Thus false1 is not printed because the subshell exits with return code zero. Commented Jul 17, 2018 at 18:40