Does set -e
behave differently here
set -e;
function foo {
}
vs.
function foo {
set -e;
}
does set -e
belong inside functions? Does set -e
declared outside of functions, affect "nested" functions inside a shell file? What about the inverse? Should we call local set -e
lol?
set -e
in a script complex enough as to need functions. Do proper error handling instead. – Stéphane Chazelas Nov 18 '17 at 11:27set -e
was never supposed to be a replacement for error handling but a safeguard to avoid catastrophic failures if handling error has been overlooked and continuing executing a script after a command failed can easily have crazy consequences, like massive loss of data. – Mecki Jan 05 '24 at 17:33