Export variables automatically:
set -a source .env set +a
Fail pipe:
set -o pipefail
cat << EOF > file.txt The current working directory is: $PWD You are logged in as: $(whoami) EOF
tee