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.

2
  • 2
    Apparently if you use set -e in your script, then errors in the trap will be returned to the caller. For example, try this command with and without the -e part: bash -e -c "trap 'false' EXIT"; echo $? Commented Oct 6, 2023 at 16:30
  • 1
    "Normal commands, whether fail or succeed, won't change the exit status.". Indeed, the "The Open Group Base Specifications" linked in the answer states The value of "$?" after the trap action completes shall be the value it had before the trap action was executed. Commented Apr 18 at 14:30