You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
#!/bin/bash##### -e: (erexit) Stop script if executed command returns non-zero exitcode except in an if-condition# -o pipefail: Non-zero exit code of a command is used as the exit code of this script# ref: https://stackoverflow.com/a/90441# -u: (nounset) Stop script if a variable is used but was never setset -euo pipefail
Make changes to the bash environment without affecting the bash environment
# Easy answer, just wrap all in a sub shell# ref: https://unix.stackexchange.com/a/721798functionmy_function ()
{
# not affected bash environment
(
set -e
# code that will stop when a command fails
)
# not affected bash environment
}