-2

We should type ./file.sh in terminal to run sh. Is there way to run it as executable file by double click ?

R S
  • 2,419

2 Answers2

6

Note: The question was edited to add "Xubuntu" after this answer was posted. This answer refers to plain Ubuntu Desktop 18.04.

You did not tell us, so I assume that you are running Ubuntu Desktop 18.04. By default, the file manager will not allow running scripts by double clicking them. To change this behavior:

  1. Open the file manager.

  2. Click on the "Files" label on the top-left of the screen. A menu will drop down.

  3. Click "Preferences". A tabbed dialog box will be displayed.

  4. Select the "Behavior" tab.

  5. Choose your preferred behavior for "executable text files" aka scripts.

File manager preferences

AlexP
  • 10,197
0

You need to right click on it and tick the box permitting it to be an executable. Then you can simply double click, you will get a pop up asking whether to execute it or not.

Rattle
  • 175
  • I don't have such, in file properties it's marked "allow file run as program". I think it has all necessary permissions: -rwxr-xr-x 1 user user 6844 Jun 12 16:48 idea.sh – R S Jul 01 '18 at 17:20
  • Even after running chmod +x ./file.sh ? – Rattle Jul 01 '18 at 17:34