Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free.

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

This question already has an answer here:

I have tried right clicking on the file selecting properties and then the permissions tab and setting it to execute. However, when I double click the file it opens in gedit. What do I do?

share|improve this question

marked as duplicate by jokerdino Apr 22 at 13:57

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

    
Is this for sure about Nautilus? Could be XFCE / Thunar too. Or the file could be mounted with noexec? Or does Nautilus even respect noexec mounts? – Xen2050 May 14 '14 at 2:03
1  
@bain I looked at that before I posted this question. I tried that solution before and it didn't work. – LarryK May 14 '14 at 2:34
up vote 17 down vote accepted

To run your script by double clicking on its icon, you will need to create a .desktop file for it:

[Desktop Entry]
Name=My script
Comment=Test hello world script
Exec=/home/user/yourscript.sh
Icon=/home/user/youricon.gif
Terminal=false
Type=Application

Save the above as a file on your Desktop with a .desktop extension. Change /home/user/yourscript.sh and /home/user/youricon.gif to the paths of your script and whichever icon you want it ot have respectively and then you'll be able to launch by double clicking it.


Specifically, for your situation, you need to do:

  1. Create a script that runs mono LOIC.exe. To do so, create a new text file with these contents:

    #!/bin/bash
    mono /home/logan/.loic/LOIC.exe
    

    Save this as /home/locan/run_loic.sh and then run this command to make it executable (or right click => properties and choose "Allow executing file as program"):

    chmod +x /home/logan/.loic/LOIC.exe
    
  2. Create a .desktop file that launches that script. Create a new text file on your Desktop called run_loic.desktop with these contents:

    [Desktop Entry]
    Name=Run LOIC
    Comment=Run LOIC
    Exec=/home/logan/run_loic.sh
    Icon=
    Terminal=false
    Type=Application
    
share|improve this answer

File Manager > Edit > Preferences > Behaviour forExecutable Text Files. In Ubuntu it is set to View Executable Files when they are opened

i prefer set it to "Ask each time" like the previous version of ubuntu.

share|improve this answer

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