How to combine two commands as a launcher?

sh -c "command 1 ; command 2"

did the job for me, directly as a launcher: just create a file and save it as program.desktop, then allow execution as a program (right click -> properties-> permissions -> allow executing as program)

[Desktop Entry]
Version=1.0
Name=ProgramName
Comment=This is my comment
Exec=sh -c "command 1 ; command 2"
Icon=/home/alex/Pictures/icon.png
Terminal=false
Type=Application
Categories=Utility;Application;

rvm use 1.9.2 && redcar

or

rvm use 1.9.2 || redcar

if the rvm-command fails, redcar is excecuted in the second example and not in the first example.


I'm not sure Gnome launcher supports this, but in a bash script a command like

program1; program2

means - start program1, then start program2 only after the first one terminates.

After some testing I think the most robust thing would be to create a simple script:

#!/bin/sh
rvm use 1.9.2 &
redcar &

set the executable bit on it and then create a launcher which starts this script, i.e. /home/yourusername/start_redcar.sh

As a bonus - if you create a directory called "bin" in your home folder, put the script there and name it "start_redcar", you'll be able to start it from terminal or from the "Run a command" window which opens when pressing Alt-F2 - by simply typing the command name