2

I've created a .desktop launcher as shown below which successfully opens terminal. What I want to do next is to run the following commands such as cd home/userA/scripts then PACKAGE_PATH=/home/userA/package1 then source setdefaults.sh through this .desktop launcher through the terminal after opening it.

My run.desktop:

#!/usr/bin/env xdg-open
[Desktop Entry]
Version=1.0
Type=Application
Terminal=false
Icon[en_AU]=/usr/pics/pic1.png
Name[en_AU]=RUN
Exec=gksu -u userA /usr/bin/gnome-terminal
Comment[en_AU]=comment
Name=RUN
Comment=comment
Icon=/usr/pics/pic1.png

So what I want to do is to automatically run a sequence of commands and scripts (through terminal) after executing the first command which opens the terminal. If anyone could please advise.

3 Answers 3

5

Try creating a .sh file with all your commands in it, and then use "x-terminal-emulator -e script.sh" to run it all in the terminal.

0
1

Another tip— running gnome-terminal.real in a script opens the GUI Terminal app. 🙂

0

If you would like to keep the terminal open from the Desktop Launcher so you can see the commands being executed or whatnot, first you need to create a script that has all of the commands you want the desktop launcher to perform, such as cd home/userA/scripts and so forth. Move the newly created script to /script/path/here and make sure it is executable. Now You need to tell the Desktop Launcher to open terminal and run that script. To do so is actually quite simple. Open up your .desktop file and replace

Exec=gksu -u userA /usr/bin/gnome-terminal

With:

Exec=gnome-terminal --execute bash -c "/script/path/here ; bash"

This should do open the terminal, keep it open, and run the script with all the commands you would like it to perform. Hope this helped!

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .