PDA

View Full Version : Question on icon to execute commands


satimis
16th October 2004, 10:34 AM
Hi folks,

I have prepared following script to create ISO image and burn the same on CD afterwards;

#!/bin/bash
if [ -z "${1:-}" ]; then
( echo "Usage: $0 imagepostfix [pathspec...]" ; echo ) >&2
exit 2;
fi

ISO_File="/path/to/To_burn/Image_${1}.iso"

shift
mkisofs -R -o "$ISO_File" -l -graft-point -hide-rr-moved \
/dir-1/=/path/to/dir-1/ \
/dir-2/=/path/to/dir-2/ \
/dir-3/=/path/to/dir-3/ \
/dir-4/=/path/to/dir-4/ "$@"

shift
cdrecord dev=ATA:1,0,0 -v -eject "$ISO_File"
# ./cdmaker xyz /dir-5/=/path/to/dir-5/ /dir-6/=/path/to/dir-6/ etc.

It works for me seamlessly.

I can create an icon executing the command "./cdmaker ABC" to create ISO image and burn the same on CD, if the name of ISO image fixed and no addition of further directory/directories. But if they are necessary then how to re-editing the script so that mini-windows will be popup for entering "name of ISO image" and "directories including their paths"

Please advise. TIA

B.R.
satimis

crackers
16th October 2004, 04:50 PM
Typically, there are two "dialog" programs installed that you can use in scripts to get inputs: gdialog (Gnome/GTK) and kdialog (KDE). To learn how they operate, open a terminal and play with them and tweak the k/g-dialog command to taste:

$ echo `kdialog --inputbox "Enter something" --title "Cracker's Test"`
foo

Notice those are "back-tics" surrounding the command. This allows the output of the command to be returned to the script, in this case as the input to the echo command. In your script, replace the echo with a variable (A=) and use that in place of the command-line options ($A).

#!/bin/sh
A=`kdialog --inputbox "Enter something" --title "Cracker's Test"`
echo $A

satimis
17th October 2004, 04:34 PM
Hi crackers,

Tks for your advice.

Is there any way to start root's xterm window directly from "Run Command' instead of starting usr's xterm windlow first;

user >su
password
root >

Please advise. TIA

B.R.
satimis

crackers
17th October 2004, 04:40 PM
xterm -e su -

Look, I know you're learning and all that, but you really should try reading some of the manpages. You'll actually learn a lot more by experimenting yourself.

satimis
18th October 2004, 05:35 AM
xterm -e su -

Look, I know you're learning and all that, but you really should try reading some of the manpages. You'll actually learn a lot more by experimenting yourself.Hi crackers,

Tks for your advice.

Both
xterm -e su -
xterm -e su

start xterm window requesting root password to proceed. I need "xterm -e su"

But I don't know how to combine it with following command

xterm -hold -T "CDMaker by satimis" -e /home/satimis/burncd_01
(which I require to create ISO image and burn it on CD)

I tried following combinations without success;

xterm -hold -T "CDMaker by satimis" -e "su /home/satimis/burncd_01"
xterm -hold -T "CDMaker by satimis" -e `su /home/satimis/burncd_01`
(back tick)
xterm -T "CDMaker by satimis" -e 'su /home/satimis/burncd_01`

Please advice

TIA

B.R.
satimis

Varkk
18th October 2004, 06:05 AM
so what you want is for your script to be run as root?
For that you will want to use the sudo command

satimis
18th October 2004, 06:22 AM
Hi Varkk,

Tks for your advice

so what you want is for your script to be run as root?
YES. I need to

- start root's xterm window with password input
- iinput entries on root's xterm window as requested by the script

All of them is executed with clicking an ICON.

For that you will want to use the sudo command
sudo is new to me.

TIA

B.R.
satimis

Zibo Travel Photos on Instagram - Fuxin - Marrakesh -