I am new to Linux and I have a problem with the shortcut which I want to create on the Desktop for the script. I’m using just one line of the script because I want to understand how to create a shortcut that will run any .sh script from the Desktop position.
I allowed Launching and also I see for one second that terminal is open, but after it is closing and I don’t see the output for example in the terminal…
Could you please advise???
2
Answers
After executing the script, the terminal will close. There are different ways to achieve what you want
$SHELL
at the end of your scriptYou can simply put a
read -p "Press Enter to Continue"
message at the end of Shell Script or put a simplesleep 5
i.e. delay of 5 seconds or any amount of delay you wantExample 1 with
read
:This will ask you for a key press and waits for you to press any key on keyboard
Example 2 with
sleep
:This will simply wait for 5 seconds and automatically exits
Also, ensure that the
.desktop
file has executable permissionssudo chmod a+x /usr/share/applications/Hello.desktop
orsudo chmod a+x ~/.local/share/applications/Hello.desktop
depending on where you have saved the.desktop
fileReference: https://askubuntu.com/a/230374/679241