Daniele Navarra
Daniele Navarra

Reputation: 159

Raspbian: start program from .sh file

I want to do this:

I tried to write a .sh file with "./program" but "program" closes automatically after flashing a console, but I want that terminal to keep open!

Upvotes: 0

Views: 718

Answers (1)

Fred
Fred

Reputation: 6995

I assume you are in a graphical environment, and want to execute a script by double-clicking the ".sh" file, then keep the terminal window open to see any result.

At the end of your script, add something like this :

echo "Hit the [return] key to exit"
read

This will cause execution to pause until you hit [return].

Note : you cannot keep a program running when it has finished executing. So the program you are calling from your script finishes, but then you give the terminal (which is also a program) something to do (waiting for input) to prevent it from closing.

Upvotes: 1

Related Questions