source /data/test.env echo $USER carlton bash # 進入子shell echo $USER
運行bash以後變量爲空shell
$ set -a $ source /data/test.env $ set +a # 關閉開關,防止以後的定義不當心被export $ bash $ echo $USER carlton
仔細看變化,發現依然能夠打印變量bash