I think the vars are being set in a subshell, try this instead: ```bash aws-sso-cli() { while read -r line; do if [[ $line =~ ^export ]]; then eval $line fi done < <(command aws-sso-cli "$@") } ```