【发布时间】:2013-01-20 08:39:21
【问题描述】:
可能重复:
what is the difference between “./somescript.sh” and “. ./somescript.sh”
请澄清shell命令之间的区别。 script.sh vs ./script.sh 其中 script.sh 是一个 shell 脚本。
谢谢
【问题讨论】:
标签: linux
可能重复:
what is the difference between “./somescript.sh” and “. ./somescript.sh”
请澄清shell命令之间的区别。 script.sh vs ./script.sh 其中 script.sh 是一个 shell 脚本。
谢谢
【问题讨论】:
标签: linux
区别很简单
. script.sh
使用您当前的 shell 执行 shell 脚本,因此您在脚本中所做的所有更改(如更改目录或变量)都会影响您正在运行的 shell
./script.sh
另一方面,将启动一个新的 shell 来执行脚本。这通常是启动脚本的更好方法
【讨论】: