How do I run a shell command when icon clicked? (Solved?)

Booting, installing, newbie
Post Reply
Message
Author
penguinman007

How do I run a shell command when icon clicked? (Solved?)

#1 Post by penguinman007 »

I have a script that I want to run in a shell.

If I open RXVT and type the name of the script, the script runs.

I want this to happen when I click an icon.

When I click this icon, I want rxvt to open and my script to run.


Currently I have an executable text file sitting on my desktop.

The contents of this file are thus:

rxvt myscript


If I click on this icon, rxvt does not run, and my script does not run.
But my intention is that when I click on this icon rxvt should run, and my script should run.

Any suggestions ?

Thanks
penguinman007

User avatar
Flash
Official Dog Handler
Posts: 13071
Joined: Wed 04 May 2005, 16:04
Location: Arizona USA

#2 Post by Flash »

Just to be sure, you have read this post, right?

prnguinman007

#3 Post by prnguinman007 »

I read that post:

#! /bin/sh

at the start of my script file does not pop up a shell.

I need a shell to pop up and display the output of the program I run within that shell.


This is the process I am trying to implement:

1. User clicks an icon.

2. Shell opens automatically and my script runs magically within this shell.



This is very basic.
I just don't know how to do it.

I can run XRVT with the following script:

XRVT

But I cant run XRVT and then run programs from within that XRVT shell because

XRVT
myscript

does not work

XRVT <myscript

also does not work

XRVT <<myscript

also does not work

myscript >XRVT
does not work

etc

thanks in advance for all the help.

Puppy is awesome
Penguinman007

User avatar
puppian
Posts: 537
Joined: Tue 19 Jul 2005, 03:58
Location: PuppyLand
Contact:

#4 Post by puppian »

See if this work:

#! /bin/sh
rxvt -e myscript

Copy the above to a text editor,
save it as /root/my-application/bin/myapp,
type "chmod 755 /root/my-application/bin/myapp" in rxvt to make it executable.

I tried this with "rxvt -e mp3blaster" and it works. However I don't how to add arguments to mp3blaster. E.g. "rxvt -e mp3blaster -a mylist.lst" (I want to tell mp3blaster to load my playlist and play automatically on startup) doesn't work. Any idea?

BTW, you can always type '--help' after a command to get more help, e.g.
rxvt--help

Guest

#5 Post by Guest »

Hey thanks for that ,

It works !

For your problem, you may want to put the application and the command line parameters into a seperate script eg:

Application -option -option

And then call this seperate script:

#! /bin/sh
rxvt -e your_script



P.S

I use ROX file manager to change scripts to executable using right_click->permissions.

User avatar
puppian
Posts: 537
Joined: Tue 19 Jul 2005, 03:58
Location: PuppyLand
Contact:

#6 Post by puppian »

Thanks for the tips, but that gives the same result...

After trying and trying I was lucky enough to get it work finally by typing this:

#!/bin/sh
cd /root
rxvt -e mp3blaster -a mylist.lst

I don't know why this works, maybe it's something about permission :?

Post Reply