0

I right click and into properties I allow the permision to run as a programe. But still cannot run it. It is still opening in text document file

  • Are you trying to run this program from within the Files manager? Double clicking will open a .sh file with GEdit (text editor) by default with Ubuntu. You should try running the command from the Terminal. – armadadrive Sep 10 '15 at 01:04
  • Can you maybe attach a screenshot of the file properties dialog showing the permissions of the file, in your question? Also, does the file start with #!/bin/sh on the first line? – dobey Sep 10 '15 at 01:55
  • The file starts with #!/bin/sh i check the permission on the properties. –  Sep 10 '15 at 12:06
  • Is your goal simply to run the script at all, or to have some way to launch the script from within the file manager, or on the launcher as well? Please clarify your question, so that a proper answer can be provided. – dobey Sep 10 '15 at 14:46
  • In the instruction the app that i downloaded.. it said "run" the install.sh and it will automatically be installed. But it opened in text document.. –  Sep 12 '15 at 15:09

1 Answers1

0

Double clicking an sh file won't execute it because sh files are really just text files containing terminal commands. It's always kind of annoyed me that certain files aren't able to be executed by double clicking them, but that's just the way Linux works. If you want to run the sh file, you need to use the terminal.

Press ctrl + alt + T to open a terminal. Now there are two ways to execute an sh script from the terminal. One is done by cding to the parent directory and then running it from there, while the other way just points directly to the file. I'll show both of them below.

For these examples I'm using my own user name and path I made up. You have to specify the actual path to your sh file.

By using cd

cd /home/zacharee/Downloads/program/
sudo ./program.sh

By just putting in the full path:

sudo /home/zacharee/Downloads/program/program.sh

Either way will work fine.

Now, if you really want to be able to double click executable scripts from your file browser to run them, you can try this:

Open Nautilus (the file browser) and open the File... menu. From here, select Preferences and go to the Behavior tab. There should be a dropdown menu option named something like Executable Text Files:. In the dropdown, select the Run ... option and apply these settings.

Source: Not executing programs (*.sh ) with double click in 13.04

TheWanderer
  • 19,395
  • 12
  • 50
  • 65