Reputation: 1324
What does the set -e
command do in SHELL scripting?
Like the following command:
set -e
Can we do any other things with set -e
operation?
Upvotes: 3
Views: 4382
Reputation: 53
Using the flag -e you ensure stops the execution if a command during the execution has an error. The default behaviour is to ignore the errors in script executions.
If you want to manage this errors, you can use the command "trap".
Upvotes: 2
Reputation: 183
The 'set' command is used set and examine shell options, as well as set positional parameters.
The -e flag does the following:
-e Exit immediately if a command exits with a non-zero status.
Hope this helps :)
Upvotes: 6