[英]Echo command not working inside shell script on git bash for Windows
伙計們,我對 git/bash/shell 腳本很不熟悉,所以請原諒這個問題的菜鳥。 我付出了很多努力來找到關於 SO、web 的答案,並通過反復試驗,但它沒有奏效。
我在Windows 10上使用git bash 。 My question is: I am able to successfully use the echo
command at the git bash command prompt, but it doesn't work inside a shell script I have written (the purpose of the shell script is to execute a few git commands in succession) .
因此,這適用於命令提示符:
echo "This is a test"
但是,如果我制作了一個名為 script.sh 的 shell 腳本,其內容如下:
echo "Running a few git commands in batch"
git status
git add .
git commit -m "Batch publishing changes"
git push
並輸入. script.sh
. script.sh
在命令提示符下,然后我看不到echo "Running a few git commands in batch"
命令的 output 即使后面的 (git) 命令工作正常。 是什么賦予了?
我會檢查 git bash 是否已添加到您的PATH
環境變量中,腳本將尋找echo
命令,但找不到該命令,然后該命令無法運行。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.