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?

1
  • 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. Commented Dec 2, 2019 at 12:41

1 Answer 1

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"

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.