Page 1 of 1
How do I run a shell command when icon clicked? (Solved?)
Posted: Wed 20 Jul 2005, 02:23
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
Posted: Wed 20 Jul 2005, 03:33
by Flash
Just to be sure, you have read
this post, right?
Posted: Wed 20 Jul 2005, 05:04
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
Posted: Wed 20 Jul 2005, 09:43
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
Posted: Wed 20 Jul 2005, 22:24
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.
Posted: Fri 22 Jul 2005, 19:05
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