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?
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 :)
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".