How can I create a application launcher for a .sh file?

I have this run.sh file, and I've create a symbolic link into my desktop.

When I double-click on it the file the following dialog appearsr

And I have to click on "run" each time. How can I create a link that runs by default?


Instead of linking directly to the .sh file create an application launcher as follows:

  • Right click on your desktop
  • Choose "Create Launcher..."
  • Change "Application" to "Application in Terminal" in the drop down box.
  • Give it a name like "Idea"
  • Enter the command like this /path/to/script/idea.sh
  • Add a comment if you like, it will show up when you mouse hover over it if you move the launcher to a menu bar.

Then when you click the launcher a terminal window will open and the command will run in there.

If you don't want to open a terminal to see any output, just use "Application" instead of "Application in Terminal".

You may have to edit the desktop file with something like gedit to add the "Path" of the script. Like This:

#!/usr/bin/env xdg-open

[Desktop Entry]
Version=1.0
Type=Application
Terminal=false
Icon[en_US]=/home/kurt/Games/dontstarve/dontstarve.xpm
Exec=/usr/games/dontstarve/bin/dontstarve.sh
Path=/usr/games/dontstarve/bin
Name[en_US]=Dont Starve
Name=Dont Starve
Icon=gnome-panel-launcher

Why not just configure Nautilus to execute by default?

Under Nautilus goto Edit->Preferences->Behavior and click:

"Run executable text files when they are opened"