执行shell脚本时,几种方式的区别。

执行shell脚本文件时,一定是

source start_py.sh

不能是

bash start_py.sh

也不能是

sh start_py.sh

还不能是

./start_py.sh

其区别在于,source启动的shell脚本,是在父进程中继续运行的。而后面的3个启动方法,是新建子进程运行的,那样切换路径和激活虚拟环境就没有意义了。

posted @ 2022-11-02 20:41  14789ztt  阅读(47)  评论(0)    收藏  举报