How do I run a script outside of Terminal?

Asked by kenbb99

I've created a script to run an Eye of Gnome slideshow from a particular directory. I put this script on the desktop. I want to run it by double-clicking on it. How do I accomplish this?

I am a Linux novice. I learned to write the script from a tutorial. The script works if I run it from Terminal or double-click on it and select run from the "Do you want to run" dialog. I am used to Windows XP but am very excited about Ubuntu and would like to learn how to use it. Thank you.

Question information

Language:
English Edit question
Status:
Solved
For:
Ubuntu Edit question
Assignee:
No assignee Edit question
Solved by:
Nicolas Van Wambeke
Solved:
Last query:
Last reply:
Revision history for this message
Martin Kaufmann (martin.kaufmann) said :
#1

have you changed the file permission to executable by chmod a+x scriptname?

Revision history for this message
kenbb99 (kenbb99) said :
#2

Following the tutorial instructions, I typed the following into Terminal:

gedit scriptname.sh

I then typed the following into the text editor:

#!/bin/bash
echo “Slideshow 1”
eog /home/user/Pictures/Slideshow/1.jpg -s

I saved this file to Desktop and entered the following into Terminal:

chmod +x scriptname.sh

According to the tutorial (http://ubuntuforums.org/showthread.php?t=337437) this will make the file executable and using Gnome, I should be able to double-click that file, execute it in the terminal, and have the script do what I want.

When I double-click this file, I get the "Do you want to run" dialog.

I deduced from your question that I should enter "chmod a+x ~/scriptname.sh" into the terminal. I did this and it did not change the behavior of double-clicking on scriptname.sh

Revision history for this message
Martin Kaufmann (martin.kaufmann) said :
#3

Hi,

i have try it at my own Workstation, i have to change the Script cause i have other Paths:

#!/bin/bash
echo “Slideshow 1”
eog /home/riot/*.JPG -s

after that i made it executable by chmod a+x test.sh. I tested it in Terminal, it works.

Now to your Question, when i try it to run from Desktop i got the Question if i want to run it in terminal, edit, cancel or run ( i hope its translated so in the english Localisation, i use German Language Support). I push run and it runs in Gnome without Terminal.

Revision history for this message
kenbb99 (kenbb99) said :
#4

When I push "Run" it runs for me as well. This is not what I'm trying to accomplish. I don't want to get the "Do you want to run" dialog at all. I want the script to run without getting the dialog. When I double-click it, I want it to run right then.

I want the scripts to behave like programs. When I double-click on the Totem icon on my desktop, it runs Totem. It does not ask "Do you want to run Totem?".

Revision history for this message
Best Nicolas Van Wambeke (nicolasvw) said :
#5

Hello,

The behavior you want to achieve can be obtained by creating a launcher pointing to your script.

Right click the desktop->Create Launcher and fill in a name, in command, browse to your file on the desktop (which you can now move somewhere else by the way).

You can now double click the launcher you just created and no dialog will appear.

Cheers,

Nicolas

Revision history for this message
kenbb99 (kenbb99) said :
#6

Thanks Nicolas Van Wambeke, that solved my question.