GM6
GM6

Reputation: 371

Keep terminal open at the end of bash script

I'm trying to run a bash script from cmd. When I execute the script a new terminal is opened an immediately closed since there is some problem with it. Because its happening so fast I can't read the problem. I'm looking for a way to keep the terminal open once the script exits.

Upvotes: 7

Views: 20862

Answers (4)

Cribber
Cribber

Reputation: 2913

You can also put a $SHELL in a new line at the end of your script. The window will stay open, no matter from where you open your shell script (e.g. cmd / powershell / etc).

Upvotes: 4

jd54
jd54

Reputation: 27

Add bash at the end of the script

It works for me.

Upvotes: 0

perry_the_python
perry_the_python

Reputation: 479

to test a .sh script in windows cmd (assuming you have bash installed and in your path environment variable): cd into parent directory, type "bash" to enter bash console, type "./", type "exit" to exit bash console

Upvotes: 0

Mark Setchell
Mark Setchell

Reputation: 207465

Go horribly Windows-y with this:

read -p "Press any key to continue" x

Upvotes: 10

Related Questions