I have a shell script that runs a GUI application on Ubuntu 12.04.
The way I'm currently running the application is that I open the terminal and go to the directory that contains that file, then do sudo ./shellScriptFileName
which runs just fine, however I have two problems, one is that this takes so much time so I would like to add a shortcut in the launcher, second is that the terminal needs to stay open, which is a pain (hopefully this won't be a problem after I'm able to run it from the launcher.
Clarification: I would like for the terminal to be closed when my application starts running.
Best Answer
Here are the steps:
1. Creating the interactive caller script
Since you want to execute the script and then have the terminal remain in an interactive mode, we need to use a special caller script, which in turn requires
expect
. We'll assume the script you want to execute is calledtest.sh
expect
withsudo apt-get -y install expect
Create the caller script with this format:
Make the caller script, say
call_test.sh
, executable withsudo chmod +x /path/to/call_test.sh
2. Creating the Launcher
Alt+F2
, and typegksudo gedit /usr/share/applications/TestSH.desktop
, where TestSH is whatever you want to call your launcher icon.The file is of the following form:
Finally, make sure the actual script is executable, with
sudo chmod +x /path/to/test.sh