I have made a shell script (test.sh) on my Lubuntu (15.04) desktop. Permissions are: Only owner (View content + Change content + Execute).

When I double click test.sh, I choose "Execute in Terminal". The Terminal (LXTerminal) opens, but the script is not executed.

When I type ./test.sh the script is executed. But that is not what I want. Solution for this problem?


Sounds like your script lacks a shebang line. Make sure the very first line of the script reads:

#!/usr/bin/env bash



On a side note, you should avoid putting .sh extension on a bash script, since bash is not sh. Preferably use no extension at all.

| improve this answer | |
  • 2
    +1. I disagree about the .sh part, but the rest seems right. – Tim May 3 '15 at 15:19
  • 1
    @Tim, .sh suggests it is an sh script, which is misleading since it's a bash script. Also see talisman.org/~erlkonig/documents/… – geirha May 3 '15 at 15:25
  • Does that apply to .js, .php, .html as well or really just bash files? – Tim May 3 '15 at 15:50
  • @tim, yes if they are commands (that have shebangs and are meant to be executed). So .html does not apply. – geirha May 3 '15 at 16:02
  • 1
    If using .sh implies it's an sh script, then why wouldn't people use .bash for a bash script? .sh means it's a shell script, and bash is a shell. I think using .sh is just a matter of preference, and a very good case can be made for using it, if desired. – Marty Fried May 4 '15 at 19:09

This sounds like a known, existing bug: lubuntu-default-settings does not specify the proper command to execute in terminal

That bug report suggests the following workaround (using X-terminal instead.)


In pcmanfm preferences, under the advanced tab, change the terminal to "x-terminal-emulator -e %s". You can also change the "terminal" value in ~/.config/libfm/libfm.conf.

An alternative workaround I've used before is creating a desktop shortcut - but then you're limited to only being able to double-click on the desktop.

To create a shortcut, you can run the command:

lxshortcut -o ~/Desktop/test.sh

(Where test.sh is the name you want the file to have on the desktop.)

This will open lxshortcut, which will create a .desktop file from your responses in a GUI.

Manually creating a .desktop file should also work.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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