Intermediate Linux & Shell Scripting
Q44 / 100

What is the purpose of "set -e" in a bash script?

Correct! Well done.

Incorrect.

The correct answer is B) It causes the script to exit immediately if any command exits with a non-zero status, helping catch errors early rather than continuing execution after a failure

B

Correct Answer

It causes the script to exit immediately if any command exits with a non-zero status, helping catch errors early rather than continuing execution after a failure

Explanation

"set -e" (errexit) makes the script abort on the first command that fails (returns non-zero), which is commonly used to prevent scripts from continuing in an unexpected or broken state after an error.

Progress
44/100