I'm writing a shell script that sets enviornment variables. It will be sourced in other scripts like
source /path/to/my-script
I want my script to use set -euo pipefail but I don't want to affect the calling script.
This will affect the calling script.
# my-script
set -euo pipefail # affects the caller
export VAR=$(get-value)
If I wrap my script in a subshell the export won't work
# my-script
(
set -euo pipefail
export VAR=$(get-value) # not exported to the caller
)