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.
edwinksl sorry for my ignorance but i am unaware of what a shebang is, im still rather new to linux
– Tyler Jul 09 '16 at 02:40this script came with and launches the game "dwarf fortress"found here:http://www.bay12games.com/dwarves/ that script wont run on double click either
– Tyler Jul 09 '16 at 02:53./libs/Dwarf_Fortress "$@"
This is callingDwarf_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 09 '16 at 03:06http://paste.ubuntu.com/18854513/ script #2 (as it runs second) this script was not created by me and was included with dwarf fortress, the script does its job and launches the intended program.
when i run the commands in script #1 in terminal manually it works properly and runs script #2, which then launches my game. therefore i know the code works. the issue is -> next comment
– Tyler Jul 09 '16 at 03:14i have to step away from the computer for the night unfortunatly
– Tyler Jul 09 '16 at 03:14#!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 09 '16 at 03:25