source shell.sh有什么用

使用source或.执行shell脚本
shell中,source 是内置命令,用途是读取文件中内容,并在当前shell中逐条执行。这种方式执行的脚本无须执行权限。source命令可以缩写为一个小数点,如:

source  test.sh    等价于   . test.sh

采用source 执行文件,可以使得变量的有效期增长,使得能在该用户下变量有效

使用./或$path/执行shell脚本
./test.sh 

/data/test.sh

需要有权限执行才行

使用sh或bash执行
sh  test.sh 

原文地址:https://www.cnblogs.com/guohu/p/13199156.html