Ubuntu desktop script to open terminal, navigate to a folder and run compass watch Ubuntu desktop script to open terminal, navigate to a folder and run compass watch shell shell

Ubuntu desktop script to open terminal, navigate to a folder and run compass watch


Either you make a shell script (.sh file, don't forget to make it executable) or you make a desktop file (.desktop). Either of those can be double-clicked, although the former might bring up a dialog asking whether you want to execute it (can be configured, but only per user, IIRC).

myscript.desktop:

[Desktop Entry]Exec=bash -c 'cd /var/www/myproject && compass watch'Name=myscriptTerminal=trueType=Application

(Note the Terminal=true part.)

myscript.sh:

#!/bin/shgnome-terminal -e 'cd /var/www/myproject && compass watch'

(Assuming you want to use GNOME Terminal.)

Of course, there are numerous other options.


I didn't get well where is your problem ...If you want to run a script like that (double clic) you should first make it executable:

chmod u+x myscript.sh

Then you just have to place a link to this script on your desktop (or the script itself if you want ...)When double-clicking it, you will have the possibility to run it in a terminal.

Then put whatever you want in your script ( the navigate "cd /var/www/myproject" , run "compass watch" part) and end the script (myScript.sh) file with $SHELL to keep the terminal open after the script execution (: