LinuxQuestions.org
Did you know LQ has a Linux Hardware Compatibility List?
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices

Reply
 
LinkBack Search this Thread
Old 10-19-2004, 01:40 PM   #1
satimis
Senior Member
 
Registered: Apr 2003
Posts: 3,357

Rep: Reputation: 50
Bash script - confirmation option


Hi folks,

I have following script to create ISO image
Code:
#!/bin/bash

# Set ISO filename...
.....
dir1="/home/satimis/Document/"
dir2="/home/satimis/Photo/"

.....
# Create ISO file...
mkisofs -R -o "$ISO_File" -l -graft-points -hide-rr-moved \
/Document/=$dir1 \
/Photo/=$dir2 \
$list
.....
How to set confirmation on
/Document/=$dir1
/Photo/=$dir2

before the script will continue to proceed,i.e. to have "accept" or "ignore" options on them

Kindly advise. TIA

B.R.
satimis

Last edited by satimis; 10-19-2004 at 01:45 PM.
 
Old 10-19-2004, 01:43 PM   #2
david_ross
Moderator
 
Registered: Mar 2003
Location: Scotland
Distribution: Slackware, RedHat, Debian
Posts: 12,047

Rep: Reputation: 64
I think you are looking for the "read" command:
man read
 
Old 10-20-2004, 01:41 AM   #3
theYinYeti
Senior Member
 
Registered: Jul 2004
Location: France
Distribution: Arch Linux
Posts: 1,897

Rep: Reputation: 61
or cdialog.
 
Old 10-20-2004, 01:43 AM   #4
hack_in_box
LQ Newbie
 
Registered: Sep 2004
Location: India
Distribution: Fedora core1, PCQ Linux2004, SuSE8
Posts: 13

Rep: Reputation: 0
Or u can use just dialog having yes no options. Dialog presents a graphical interface for Command Line apps. For more
man dialog
 
Old 10-21-2004, 07:29 AM   #5
satimis
Senior Member
 
Registered: Apr 2003
Posts: 3,357

Original Poster
Rep: Reputation: 50
Hi folks,

Tks for your advice.

I re-organize my question as follows in anticipation to make it clearer;

I have following command line embedded on a desktop icon and a script. They work for me.

Command line
Code:
xterm -hold -T "CDMaker by satimis" -e "su -c /path/to/cdmake"
Script
Code:
#!/bin/bash
# Set ISO filename...
user=$(whoami)
now=$(date +%Y.%m.%d.%R)
ISO_File="/home/satimis/To_burn/image_${user}_${now}.iso"
dir1="/home/satimis/Document/"
dir2="/home/satimis/Photo/"

# Loop to get directories...
echo "Enter directories to burn.  Leave blank to end list"
entry="empty"
list=""
count=0
until [ -z $entry ]; do
  echo -n "Enter a directory: "
  read entry
  if [ $entry != "" ]; then
    list="$list $1$entry"
  fi
done


# Create ISO file...
mkisofs -R -o "$ISO_File" -l -graft-points -hide-rr-moved \
/Document/=$dir1 \
/Photo/=$dir2 \
$list


# Burn ISO file to disc
cdrecord dev=ATA:0,0,0 -v -eject “$ISO_File”

# Remove ISO file
rm “$ISO_File”

Steps taken as follow;
1)Clicking the icon starting xterm
2)Enter password to login as root
3)Enter further directories, if any, with corresponding path in the form of “/Dir_AAA/=/path/to/Dir_AAA, etc. (cdrecord format). (If no further entry just hit <Enter> to continue)

Remark:
dir1="/home/satimis/Document/"
dir2="/home/satimis/Photo/"
are permanently added.

Then the script will take care of the rest and a CD is burnt finally.


Now I need to re-edit;
1)The command line as
Code:
xterm -hold -T "CDMaker by satimis" -e /path/to/cdmake"
Let the script to handle login as root to execute commands on background.

2)Re-edit the script to perform

a)
Login as root after ISO_File created because USER is not allowed to burn CD.
(I don't want to add USER to the wheel using this route. Hoping to learn more on script)

b)
Re-edit the script to perform following steps.

b-1)
The script is evoked by the revised command line

b-2)
Before
dir1="/home/satimis/Document/"
dir2="/home/satimis/Photo/"

are added, confirmation is now required. It will pop up for entry of “yes” or “no”. If “yes” they will be added. If “no” they will not be added. The script will continue to next command asking for adding of further directory/directories with corresponding path.

Remark:
dir1="/home/satimis/Document/"
dir2="/home/satimis/Photo/"
are still added on the script

b-3)
After an ISO_file created, it will continue to login as root asking for input of root password.

b-4)
After a CD burnt, xterm will close. I'll remove the option “-hold” later to get it done.


Please advise. I'm now getting into some confusing.

TIA

B.R.
Satimis
 
  


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
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
bash script: using "select" to show multi-word options? (like "option 1"/"o zidane_tribal Programming 6 03-21-2013 10:35 AM
shell script asking for confirmation? bikov_k Programming 6 11-04-2005 02:16 AM
Bash backup script failing using tar and --newer option saldkj Programming 3 03-12-2005 12:03 PM
send automatic input to a script called by another script in bash programming jorgecab Programming 2 04-01-2004 12:20 AM
bash script prob: how can i tell the script that a 'dd' has finished? Frustin Linux - General 2 04-02-2003 05:34 AM


All times are GMT -5. The time now is 11:22 AM.

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