4

I recently migrated from fedora 10 to Ubuntu 14.04 and believe me it was a real challenge :)

I almost managed to work anything out but only one problem is remaining. in fedora 10 i used to create .sh file containing commands to be executed in terminal and easily run those by double clicking on .sh file.

here is the method i was using in fedora:
1- creating a file with gedit
2-typing the command in it
3- chmod u+rwx example.sh

I followed the same method in Ubuntu but it does not work. however the shell file works perfectly when I type sh example.sh . also I read somewhere to go and allow the file to be executable and choose terminal as a default program for shell script file type, but there is no terminal in that list.

2 Answers2

9

There's a simple method to make executable on Ubuntu; I've done so and it's worked fine.

You can either use the graphical method, by opening the properties dialog of the script, selecting permissions and Allow executing files as program.

Or you can run chmod +x yourscript.sh.

First though, make sure your file manager supports executing files:

gsettings set org.gnome.nautilus.preferences executable-text-activation ask
TellMeWhy
  • 17,964
  • 41
  • 100
  • 142
3

You doing everything correctly, but there's one more extra step - you need to tell the default file manager to allow running executable files.

Open the file manager and go to Edit -> Preferences -> Behavior. Check "Run executable files when they are opened" (it's under Executable Text Files).

Once you do that, you will be able to run those. Remember however, that if you actually want to see them run in terminal, you need to specify that in the script itself. For instance,

#!/bin/sh
gnome-terminal -e 'mc' &