Hairi Hairi - 3 months ago 21
Git Question

Cant run shell script using Git Bash interface on Windows10

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:

enter image description here

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?

Answer

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