2

I have a simple script that I want to be able to run by double clicking a text file and having it run in terminal so i don't have to do it manually

#!bin/bash
$ cd /home/tyler/df_linux
$ ./df

I've tried "allow executing file as program" but the file still opens in gedit.

I've also used sudo chmod +x df while in the directory, terminal asks for my password, i enter it, and then nothing happens.

I've been looking around the internet and my problems are similar to that of if my HDD was NTFS format, i checked using sudo blkid -o list > ~/myFileSytems and I can see that the script I'm trying to run is in an ext4 partition; so, that isn't the issue.

I've been looking around the internet all day and have found people with similar problems but none of the solutions that I have found have worked.

My question was marked as a duplicate of How do I run executable scripts in Nautilus? and i do not understand why, my problem has nothing to do with nautilus and i cannot seem to find any program called nautilus on my computer.

I am running Ubuntu 14.04.03 and I am trying to run my script in terminal, I am using hashbang and the color of the text in my script has changed to identify that linux understands that it is a script, but the script will not run when I double click the file.

  • 4
    Possible duplicate of How do I run executable scripts in Nautilus? – Florian Diesch Jul 9 '16 at 2:38
  • 1
    @Tyler when you post code in the comments it is hard to read , because it's all jammed up. Use paste.ubuntu.com , post the contents, then provide link here. One thing that I've noticed is that you are calling ./libs/Dwarf_Fortress "$@" This is calling Dwarf_Fortress with command line parameters given to the script. In your example posted above, you only call ./df and no arguments ; what is expected is something like ./df one_arg second_arg . I'd like to help you troubleshoot the stuff , so let me know once you post it to the pastebin site or find me in the askubuntu chat – Sergiy Kolodyazhnyy Jul 9 '16 at 3:06
  • 1
    @FlorianDiesch This question is not a duplicate. OP clearly knows how to run scripts and he even allowed it in the Nautilus. Please retract your close vote, as the issue here is different . Potentially there is a syntax error of sorts – Sergiy Kolodyazhnyy Jul 9 '16 at 3:07
  • 1
    *CLOSE VOTERS Please retract the votes, as the issue here is very different from the suggested duplicate. OP clearly knows how to run scripts and allow them in file manager. – Sergiy Kolodyazhnyy Jul 9 '16 at 3:08
  • 2
    What you've posted doesn't appear to be a valid script (1) #!bin/bash isn't a valid interpreter (it needs to be #!/bin/bash - note the leading slash) and (2) you appear to have included shell prompts $ at the start of each command. Until you can execute it in a terminal using ./scriptname it is pointless trying to get it to run as a double-click executable. – steeldriver Jul 9 '16 at 3:25
0

Using Thunar (XFCE): https://bbs.archlinux.org/viewtopic.php?id=194464

Using Dolphin (KDE): http://ubuntuforums.org/showthread.php?t=1882254

Please post what file manager you are using.

EDIT: Script #1's lines appear to have $s before them. Remove those.

  • I tried both and the instructions for dolphin worked! I'm now able to launch my program by double clicking on the script. – Tyler Jul 9 '16 at 15:16

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.