set -euo pipefail 

is a common “strict mode” line that makes your shell script fail fast and not silently ignore errors.?
What each flag does
set -e
Exit the script immediately if any simple command returns a non?zero status (an error), instead of continuing and possibly doing the wrong thing based on bad state.?
set -u

Treat use of unset variables as an error and exit, which helps catch typos and missing environment variables ($FOO when FOO was never set).?

set -o pipefail

Make a pipeline like cmd1 | cmd2 | cmd3 return a non?zero status if any command in the chain fails, not just the last one; this prevents errors in the earlier stages of a pipeline from being silently ignored.?

Together, set -euo pipefail makes scripts much safer: they stop on the first real error, they don’t quietly substitute empty strings for missing variables, and they properly detect failures inside pipelines instead of reporting success when something actually broke earlier in the chain.?


