Cant run shell script using Git Bash interface on Windows10

匿名 (未验证) 提交于 2019-12-03 09:18:39

问题:

Following this post I wasn't able run shell trough Git bash. This is the batch file :

%ComSpec% /c ""C:\Program Files\Git\git-bash.exe" --login -i -- C:\Users\rmrd001\Documents\Git\scripts\first\test.sh" pause 

This is the shell script:

echo Hello, World! 

And this is what I get when batch is run:

I can see the instantaneous appearance of the bash program, but can't catch the text into it. I double-triple-checked the paths, they are correct. I ran the script trough the Git bash, everything worked well (the message appeared).

Any ideas?

回答1:

I have seen a different syntax before.

I only see the message with:

start "" git-bash.exe -i -l -c "/C/path/to/script.sh" 

With script.sh including a pause:

echo Hello. World! read -n1 -r -p "Press any key to continue..." key 

The OP Hairi report in the comments making it work with:

start /b cmd /c "C:/Program Files/Git/git-bash.exe" /C/path/to/script.sh 


标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!