1

I had a command:

"D:\Program Files\Git\bin\bash.exe" --login -c "git log -2"

but when I exec the such shell script, it print the result and quick exit.

I search bash refrence:

https://www.gnu.org/software/bash/manual/bash.html#Invoking-Bash

-c

Read and execute commands from the first non-option argument command_string, then exit.

I do not want exit. I want the command can pring log and hold on, so I can see it.

So what should I do?

lyq
  • 98
  • 7
  • Simply `D:\Program Files\Git\bin\bash.exe` will run an interactive Bash shell if it is correctly configured. If (as it seems) you are on Windows, there may be additional complications. I always recommend removing Windows from the equation if you can. – tripleee Dec 02 '19 at 12:41

1 Answers1

1

Three options (at least):

  1. Install git properly in your Windows, so you can just run git log directly, without the need to run bash first.
  2. Run the same command you used in a Windows console.
  3. Run the same command, only with another command that waits for any key to be pressed, like:

    "D:\Program Files\Git\bin\bash.exe" --login -c "git log -2 ; read -n1"

DannyB
  • 12,810
  • 5
  • 55
  • 65