繁体   English   中英

shell 脚本在 bash -l 后停止运行

[英]shell script stops running after bash -l

我是 shell 脚本的新手,我创建了一个包含以下内容的run_all.sh文件,

cd directory1/folder1
bash -l
conda activate py38
poetry install 
./scripts/run_myscript.sh

如果我在终端中逐行执行这些行,我没有问题,但是当我将所有内容放入run_all.sh文件并执行( bash run_all.sh )时,只有前两行被执行,然后它停止而不打印任何错误代码。

Note: I am using Sagemaker which uses sh as the default shell and not bash so in manual run I start new shell ( bash -l ) to activate py38 through conda ( conda conda activate py38 ) and install the requirements...

如果您看到我在这里缺少的东西,请告诉我。

男人哦男人。

#!/bin/sh
cd directory1/folder1 && conda activate py38 && poetry install && ./scripts/run_myscript.sh

如果sh是您的默认 shell 并且您想要 bash,请像这样更改您的脚本:

#!/bin/bash -l
cd directory1/folder1
conda activate py38
poetry install 
./scripts/run_myscript.sh

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM