What is the meaning of the below command? I am new in shell scripting.
set -e -o pipefail
What is the meaning of the below command? I am new in shell scripting.
set -e -o pipefail
End the script immediately if any command or pipe exits with a non-zero status.
I don't usually use these two flags, but if you're just getting started shell scripting, this would be like turning on warnings or strict mode in other languages.
-eExit immediately if a command exits with a non-zero status.
-o <option-name>Sets the
<option-name>flag. In this case, it sets thepipefailoption.
pipefailIf set, causes the pipeline to return the exit status of the last (rightmost) command to exit with a non-zero status. It returns zero if all commands in the pipeline exit successfully. This option is disabled by default.