簡體   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