执行shell脚本的几种方法及区别

                 执行shell脚本的几种方法及区别                       

http://blog.csdn.net/lanxinju/article/details/6032368 (认真看)

注意:如果涉及到脚本之间的调用一定要用 . 来执行shell脚本。

[root@bogon ~]# cat a.sh
#!/bin/bash
Tang=Freddy
[root@bogon ~]# sh a.sh
[root@bogon ~]# echo $Tang

[root@bogon ~]# . a.sh
[root@bogon ~]# echo $Tang
Freddy
[root@bogon ~]#

原文地址:https://www.cnblogs.com/tangshengwei/p/5513284.html