zxin10@appshopwap2:~/temp> cat test.sh
export ABC=AABBCC
1,当前shell进程下执行。
1.1 . ./test.sh
1.2 source test.sh
执行结果后检查环境变量:
echo $ABC,结果为空。
2,当前shell进程开一个子shell进程执行。
2.1 .test.sh
2.2 bash test.sh
执行结果后检查环境变量:
echo $ABC,结果为AABBCC。
zxin10@appshopwap2:~/temp> cat test.sh
export ABC=AABBCC
1,当前shell进程下执行。
1.1 . ./test.sh
1.2 source test.sh
执行结果后检查环境变量:
echo $ABC,结果为空。
2,当前shell进程开一个子shell进程执行。
2.1 .test.sh
2.2 bash test.sh
执行结果后检查环境变量:
echo $ABC,结果为AABBCC。