Bash script doesn't run from nautilus, but does run from terminal

Before I add more detail to my question, I have to say something very important:

Yes, my script has "Allow executing file as program" turned on.

The question itself:

For programming reasons (shared libraries), I can't execute my program just from the executable, because I need to access LD_LIBRARY_PATH before executing the program. I created this script to do this (baring in mind this is my first time ever writing a script):

#!/bin/bash
#Get the current directory and append the SO's location
currentDir=$(pwd)'/libs/'

#Change the library path
export LD_LIBRARY_PATH=$currentDir

#Run the program
./program

After running this from the terminal I thought that it has worked, there were no errors and the program didn't complain about shared libraries. But unfortunately, if I try to double-click the .sh file from Nautilus, nothing happens. The worst part as well, is that since I'm running it from the GUI, I have no idea what error it is getting. I'm running Ubuntu 14.04 and the executable is a C++ program using the SFML libraries (Yes I could just have the dependencies, but SFML isn't commonly installed on Linux computers, and this is besides the point).


Solution 1:

The property Allow executing file as program is not enough.

Change the settings in Nautilus Preferences

enter image description here


or via terminal:

gsettings set org.gnome.nautilus.preferences executable-text-activation ask