LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 09-26-2005, 04:27 PM   #1
apffal
Member
 
Registered: Sep 2003
Posts: 72

Rep: Reputation: 15
shell script


I can run a shell script in command line, but not when clicking on its icon.
Why ?
Thanks.
 
Old 09-26-2005, 05:04 PM   #2
Matir
LQ Guru
 
Registered: Nov 2004
Location: San Jose, CA
Distribution: Debian, Arch
Posts: 8,507

Rep: Reputation: 128Reputation: 128
What happens when you click on its icon?
 
Old 09-26-2005, 05:14 PM   #3
apffal
Member
 
Registered: Sep 2003
Posts: 72

Original Poster
Rep: Reputation: 15
It happens nothing !
The script simply doesn't run ...
 
Old 09-26-2005, 06:07 PM   #4
tkedwards
Senior Member
 
Registered: Aug 2004
Location: Munich, Germany
Distribution: Opensuse 11.2
Posts: 1,549

Rep: Reputation: 52
What desktop environment are you in? I don't think you can run a shell script from the GUI - you have to either open a terminal window and drag-and-drop the shell script into it OR create a shortcut to the shell script and in the options specify 'run in terminal'.
 
Old 09-26-2005, 06:11 PM   #5
slackMeUp
Member
 
Registered: Nov 2003
Distribution: Slack-where?
Posts: 654

Rep: Reputation: 30
if you are in KDE..

when you click the script icon it assumes you want the CWD to be ~/ vs where the script is located.

As well you will need to do #chmod +x /path/to/file on the scipt so it will run after clicking it. Else, kde will just open it in a text editor.
 
Old 09-26-2005, 06:35 PM   #6
apffal
Member
 
Registered: Sep 2003
Posts: 72

Original Poster
Rep: Reputation: 15
I want to run a executable jar file without using command line.
So, what is the best way to do it ?
 
Old 09-26-2005, 07:22 PM   #7
tkedwards
Senior Member
 
Registered: Aug 2004
Location: Munich, Germany
Distribution: Opensuse 11.2
Posts: 1,549

Rep: Reputation: 52
Just create a shortcut to it (a 'Link to Application') on your desktop or create an entry in the menus for it. Making sure to enable the 'Run in Terminal' option.
 
Old 08-31-2006, 05:06 PM   #8
SChipS
Member
 
Registered: Mar 2005
Posts: 56

Rep: Reputation: 15
shell script

I hope this is considered related to this problem.

I wanted either a Panel icon to click on to play a .wav sound file, or a Desktop icon to do the same thing, preferably a Panel icon. I wanted the sound file to play in the background, without opening a terminal. Click the icon, hear the sound, that's it, no terminal window or program window to close.

This solution solved both.

I placed my sound.wav file in "me" /home directory (/home/me) so it was in the path.

Using "gedit" I made the following simple bash shell script named: "sound.sh"


#!/bin/bash
clear
/home/me
play sound.wav


This file (sound.sh) was then placed in the directory /home/me. "play" is a linux program, I suppose furnished either with bash or the system somehow. "play" satisfies playing the sound file in the background, rather than opening Real Player, Banshee, or another program.

The sound.wav file was opened for "Properties", and under "Open With" the "Add" button was clicked and "Use a custom command"(option at bottom) was used to add "play" to the list. "play" was then selected via the radio button in the "Open With" dialog box of Properties.

I took an instrument "image.gif" file and used Gimp to convert in to a "image.png" file, then saved the new "image.png" in the "me" directory.

Use "su" to be as root and copy the "image.png" to the /opt/gnome/share/pixmaps directory.

To put it all together, right click on a space in the Panel. Click on "Add to Panel", click on "Custom Application Launcher", give the launcher a name (Bells), browse for the "Command:" (/home/me/sound.sh). Finally, assign an "Icon:" to the script from the selections offered (/opt/gnome/share/pixmaps).

This allowed playing the sound.wav with one click on the panel "Bells" image.png icon.

By right clicking on the desktop you can also create a launcher for the desktop, where on my system it would have taken 2 clicks to play the sound file in the background. Lazy me opted for the one click panel approach.

Thanks to all those who have offered assistance to me here, and I hope this is some bit of a payback.

I'm using Suse Linux Enterprise Desktop 10 on a Dell Optiplex GX260.

$Chip$
 
  


Reply



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 On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Shell script inside shell script treotan Linux - General 4 02-19-2009 06:34 AM
Shell Scripting: Getting a pid and killing it via a shell script topcat Programming 15 10-28-2007 02:14 AM
shell script problem, want to use shell script auto update IP~! singying304 Programming 4 11-29-2005 05:32 PM
Directory listing - Calling shell script from a CGI script seran Programming 6 08-11-2005 11:08 PM
[SHELL SCRIPT] Write at the right of the shell window Creak Linux - General 2 04-02-2004 03:00 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 11:51 PM.

Main Menu
Advertisement
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
Open Source Consulting | Domain Registration