LinuxQuestions.org
LinuxAnswers - the LQ Linux tutorial section.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices

Reply
 
Search this Thread
Old 04-05-2007, 01:45 AM   #1
foo1234
LQ Newbie
 
Registered: Apr 2007
Location: Australia
Distribution: KDE 3.3.1
Posts: 5

Rep: Reputation: 0
Unhappy How to execute a shell script by clicking on it?


Hi guys,

I m a newbie at Linux and was wondering how I can execute a shell script without using the command line. I made a shell script mdla.sh the contents as follows:

java -jar helloworld.jar prop.conf

it runs fine by me typing:

./mdla.sh

but when i click or double click on it nothing happens and I have full permissions on that file.

cheers
foo
 
Old 04-05-2007, 01:48 AM   #2
foo1234
LQ Newbie
 
Registered: Apr 2007
Location: Australia
Distribution: KDE 3.3.1
Posts: 5

Original Poster
Rep: Reputation: 0
oops, forgot to mention I m using knoppix live-cd

thanks again
foo
 
Old 04-05-2007, 02:37 AM   #3
Junior Hacker
Senior Member
 
Registered: Jan 2005
Location: North America
Distribution: Debian testing Mandriva Ubuntu
Posts: 2,687

Rep: Reputation: 59
The only way I can muster, is to create an icon on the desktop for a "link to an application", and put the path to it in the "command" field of the application section (Tab). If you have it in /home/user, the command path would be /home/user/./mdla.sh. But if you shut her down, your icon is history, but if you're using a partition on the drive to access data or as your /home, put the icon in there, and put the appropriate path to the script. Then just click on the icon.

Last edited by Junior Hacker; 04-05-2007 at 02:38 AM.
 
Old 04-05-2007, 10:18 AM   #4
nightshade_1977
Member
 
Registered: Nov 2006
Location: Oklahoma City, OK
Distribution: Suse, Fedora, RHEL, Ubuntu
Posts: 112

Rep: Reputation: 15
you should be able to just change permissions on the file, and make it executable.

if your not sure how to do this open a terminal and type
Quote:
man chmod
hope this helps
 
Old 04-06-2007, 06:45 AM   #5
foo1234
LQ Newbie
 
Registered: Apr 2007
Location: Australia
Distribution: KDE 3.3.1
Posts: 5

Original Poster
Rep: Reputation: 0
I ready have 777 permissions to the file, but when I click on it nothing happens

Junior Hacker, my app is going to be packaged to the live-cd so it could be used on the run on any machine... so storing data in a partition is a no go me
 
Old 04-06-2007, 07:49 AM   #6
nightshade_1977
Member
 
Registered: Nov 2006
Location: Oklahoma City, OK
Distribution: Suse, Fedora, RHEL, Ubuntu
Posts: 112

Rep: Reputation: 15
try this
Quote:
chmod a+x mdla.sh
if it still doesn't work after that I'm not sure what else you could try
I'm still a bit of a newbie myself here
 
Old 04-06-2007, 08:10 AM   #7
dickgregory
Member
 
Registered: Oct 2002
Location: Houston
Distribution: Arch, PCLinuxOS, Mint
Posts: 257

Rep: Reputation: 34
Can you be more specific about what you are clicking on? Are you trying to click on the file within a file manager like konqueror or nautilus? AFAIK they don't work the same way as the MS Windows Explorer. At least I have never been able to launch an executable from the file managers. That is one convenience I miss from MS, and if there is a way to do it I hope someone will chime in and show us how.

With that said, welcome to LQ. If you update your LQ profile with information about your system it will make it easier for others to help you.
 
Old 04-06-2007, 08:51 AM   #8
sonicbhoc
Member
 
Registered: Aug 2006
Distribution: Gentoo
Posts: 61

Rep: Reputation: 15
To do it, click any file and press CTRL+E if you run KDE. I don't know if you can do this in anything but Konqueror, though.
 
Old 04-06-2007, 01:08 PM   #9
gothicbob
Member
 
Registered: Sep 2005
Location: Birmingham / Bath Uk
Distribution: Kubuntu 8.10, Debain 4.0
Posts: 86

Rep: Reputation: 16
right click > properties > permissions, tick the "is executable" checkbox
 
Old 04-09-2007, 07:19 PM   #10
foo1234
LQ Newbie
 
Registered: Apr 2007
Location: Australia
Distribution: KDE 3.3.1
Posts: 5

Original Poster
Rep: Reputation: 0
dickgregory: I have just updated some distro details (not sure if thats quite right...) hopefully that will help.

sonicbhoc: the ctrl + E sort of works in the file manager, where it pops up a confirmation on the script to be executed... but not on the desktop (anyone know why?).

Sorry for making this difficult guys I m trying make an app that will "appear" on the desktop. I want to have the files of the app (jar file and a conf file) in a directory and have a shell script to execute the app from the desktop, where the user simply needs to click on the shell script on the desktop to execute the app.

Is this possible? or is there any way to get around this to make it happen?

Thanks heaps guys,
 
Old 04-17-2007, 04:24 PM   #11
dogatemycomputer
LQ Newbie
 
Registered: Apr 2007
Posts: 6

Rep: Reputation: 0
execute from within KDE file manager

I agree. There should be a way to tell KDE to launch the file as an executable when clicking on it from within the file manager.

If anyone has any thoughts on how this is done *properly* then we would appreciate your input!

Thanks!
 
Old 04-17-2007, 04:59 PM   #12
dogatemycomputer
LQ Newbie
 
Registered: Apr 2007
Posts: 6

Rep: Reputation: 0
Smile Figured it out..

I figured it out. You need to basically create a text file with this format:

[Desktop Entry]
Comment=StartTrueCrypt
Comment[en_US]=StartTrueCrypt
Encoding=UTF-8
Exec=kdesu /opt/kde3/bin/kmdr-executor /media/GREEN/truecrypt/onekript.kmdr
GenericName=StartTrueCrypt
GenericName[en_US]=StartTrueCrypt
Icon=exec
MimeType=
Name=StartTrueCrypt
Name[en_US]=StartTrueCrypt
Path=$HOME/Desktop
StartupNotify=true
Terminal=false
TerminalOptions=
Type=Application
X-DCOP-ServiceType=
X-KDE-SubstituteUID=true
X-KDE-Username=root


[Desktop Entry] #this seems to tell KDE that its a desktop icon
Comment=StartTrueCrypt #this is comment that appears when highlighting it
Comment[en_US]=StartTrueCrypt #you can comment in different languages
Encoding=UTF-8
Exec=kdesu /opt/kde3/bin/kmdr-executor /media/GREEN/truecrypt/onekript.kmdr #command line
GenericName=StartTrueCrypt #no idea
GenericName[en_US]=StartTrueCrypt #no idea in english
Icon=exec #you can change the icon here
MimeType= #no idea
Name=StartTrueCrypt #icon name
Name[en_US]=StartTrueCrypt #icon name in english
Path=$HOME/Desktop #path where to start .. i entered /home/walkerd/Desktop and KDE adjusted it for me
StartupNotify=true #i'm not sure
Terminal=false #tell it if you want it to start in a terminal window for some reason
TerminalOptions= #no idea what options you could put here
Type=Application #its an app but I guess you could specify something else
X-DCOP-ServiceType=
X-KDE-SubstituteUID=true #if you want it to start as another user such as root then enter TRUE othewise FASE
X-KDE-Username=root # the userid you want it to start as. I asked this one to run as root.


Once you create and save the document it will automatically change the icon. You may need to make sure its configured as an executable otherwise i'm not sure it will actually launch. Hope this helps?
 
Old 04-18-2007, 12:18 AM   #13
foo1234
LQ Newbie
 
Registered: Apr 2007
Location: Australia
Distribution: KDE 3.3.1
Posts: 5

Original Poster
Rep: Reputation: 0
cule, very nice i will definitely give it a go. cheers mate
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
cannot execute script file from shell shahrahulb Linux - General 4 03-04-2008 07:02 AM
shell script to execute my c executable cranium2004 Programming 2 04-06-2005 05:26 AM
shell script won't execute brandnewbie Linux - Newbie 7 08-10-2004 01:30 PM
how to execute shell script with c code? khucinx Programming 3 05-04-2004 02:54 PM
shell script how to execute x2000koh Programming 6 07-29-2003 04:20 PM


All times are GMT -5. The time now is 10:42 PM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration