7

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).

19
  • Add the line notify-send $LD_LIBRARY_PATH below the line export… and test it again.
    – A.B.
    Aug 15, 2015 at 17:55
  • @JacobVlijm Do you know how I can cd to the correct directory, even if it has a spaces? Because when I try to call the script it cuts off at any space Aug 15, 2015 at 17:58
  • @A.B. No difference, same output in terminal, same lack of anything in nautilus Aug 15, 2015 at 18:00
  • No notification? Nothing?
    – A.B.
    Aug 15, 2015 at 18:01
  • Me? cd "your path even with spaces"
    – A.B.
    Aug 15, 2015 at 18:02

1 Answer 1

8

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
1
  • When you put a screen shot which of those settings do you exactly mean?
    – ar2015
    Feb 14, 2021 at 17:03

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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