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*

4
  • The `(....)``construct starts a separate shell to run its contents, any settings in it don't apply outside. Commented Feb 21, 2013 at 3:13
  • 1
    @vonbrand, you missed the point. He wants it to apply inside the subshell, but the || outside the subshell affects the behavior inside the subshell. Commented Feb 21, 2013 at 5:38
  • 2
    Compare (set -e; echo 1; false; echo 2) with (set -e; echo 1; false; echo 2) || echo 3 Commented Feb 21, 2013 at 15:48
  • from stackoverflow here is a good workaround --> set +e ; ( set -e; f ) ; err_status=$?; set -e; then you can do an if statement on the err_status. Commented May 18, 2023 at 14:30