Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

So I tried making a desktop shortcut which executes a very simple shell script. But when i double click/right click->execute it, it does nothing. (or at least I think it does nothing)

heres how my shortcut and shell script looks: Note the shortcut has "Terminal" set to 1, and i hope that means that it opens the shell script in a new terminal window.. (i have a couple terminals already open, which arent ready for usage (have scripts running))


[Desktop Entry]

Shell Script:

# (I tried both, /bin/bash and /bin/sh)
echo "hi"
share|improve this question

Both the desktop entry and the shell script should have executable permissions. Do:

$ chmod +x path_to_shortcut/shortcut.desktop
$ chmod +x path_to_script/  

Another way to change permissions for a script is to right click it, go to Properties > Premissions and check Allow executing file as program.


share|improve this answer
it does not fully work but it does execute now. But is that even the right way? I used the right click, create launcher button.. shouldnt that automatically give my launcher execution permission.. hows that user friendly.. thats also the reason why i didnt give it +x myself, i only gave +x to – DeadSix17 Feb 19 '13 at 2:03
You have to give executable permissions explicitly, see edit to my answer. – ignite Feb 19 '13 at 2:09
i told you i did that from the begin (just not on the shortcut).. the problem is that the script doesnt open in a new Terminal, also adding this command opens a terminal though: "/usr/bin/xfce4-terminal" so i thought hm.. probably terminal allows argument 1 to be a shell script .. and i tried that.. but doesnt work. So to make it more easy to understand what i need, i want a Shortcut that opens a NEW! Terminal and runs a specific Shell Script in it. (I did add execution permissions to both, the shortcut and the Script) Also tried running terminal itself and gave it a shell script path as arg – DeadSix17 Feb 19 '13 at 2:24
As you have set Terminal=True, your script should have opened in a terminal itself or you want two terminals? – ignite Feb 19 '13 at 2:35
No, i want a single terminal to open even if there are already X ammount of terminals open. – DeadSix17 Feb 19 '13 at 2:35

Just in case someone comes here from google search... In 14.04 it's been a pain in the rear to execute shell script which starts Android Studio for me on the mounted drive. Tried numerous things but nothing worked for me. Eventually had to write below code and compile with:

gcc -o studio studio.c 

and then create a shortcut to "studio" from the desktop and now it finally works as it should.

Here is the sample code, you can replace path (/media/.../ in that system call after /bin/sh. Make sure it's a full path and leave "/bin/sh " in front.

#include <stdio.h>
int main(void) {
  int ret = system("/bin/sh /media/jeneag/APPS/linux/android-studio/bin/");
  printf("app ret code: %d\n", ret);
  return 0;
share|improve this answer
While this certainly works, I don't see the point of jumping through all these hoops when marking the script executable and symlinking it to the desktop should do. – David Foerster Oct 21 '14 at 14:18
Only if that worked all of the time: -rwxrwxrwx 1 jeneag jeneag 5889 Aug 8 13:39 It is executable, but still opens in vim/editor. Not to mention that external/internal mounted HDD unless property defined in /etc/fstab with ntfs-3g exec,users,permissions... lines it will be owned by root:root and chmod +x would not do anything at all. – Jenya G Oct 21 '14 at 15:08
You probably forgot to configure the file browser to run executable files instead of viewing/editing them. – muru Oct 21 '14 at 15:18
That and does the shell script start with a shebang (though /bin/sh is the default interpreter for files without one)? – David Foerster Oct 21 '14 at 15:30
Yes it starts with #!/bin/sh. As far as configuring, nothing was changed from 12.x ubuntu when I did an upgrade to 14.04 2 days ago. Last couple of releases Ubuntu makes me and my dev friends spend 1+ hours on configurations to get rid of all of that fancy stuff so desktop would be useful for software development. – Jenya G Oct 21 '14 at 15:32

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.