问题
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
来源:https://stackoverflow.com/questions/39200723/cant-run-shell-script-using-git-bash-interface-on-windows10