2

Here is my desktop entry to run "PRGM.sh"

[Desktop Entry]
Encoding=UTF-8
Name=PRGM
Comment=Launch PRGM
Exec=gksu /home/markku/PRGM.sh
Icon=utilities-terminal
Type=Application
Terminal=true

The program runs in terminal and at the end outputs a code I want to check. But the desktop entry runs the program in terminal and closes when it finishes so can't check the code. How can I modify the desktop entry to not close the terminal after execution? (It is required to use gksu)

2 Answers2

3

Use @Dane's solution (copied here):

read -n1 -p "Press any key to exit."
exit

And change two lines in the .desktop file:

Exec=gksu "gnome-terminal -x bash -c /home/markku/PRGM.sh"
...
Terminal=false

Or if sudo would work fine, it's simpler:

Exec=sudo /home/markku/PRGM.sh
...
Terminal=true
wjandrea
  • 14,504
2

At the end of the script, remove any "exit", and replace it with:

read -n1 -p "Press any key to exit."
exit

This will display the quoted message, and wait for the user to press a key, after which it will exit. You can put a number (or variable containing a number) after "exit" to exit with a status, if desired.

DaneM
  • 376