The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com



Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Shell script answer prompts? eltinator Shell Programming and Scripting 4 08-29-2007 11:15 AM
UNIX Auto-login nvanduyne UNIX for Advanced & Expert Users 1 06-15-2006 10:16 AM
Auto FTP from UNIX to Windows Server songtam High Level Programming 1 04-07-2006 07:26 AM
Auto Alias Script coolboarderguy Shell Programming and Scripting 3 12-25-2005 09:11 AM
the unix answer to SSI? garrettcarr UNIX for Dummies Questions & Answers 1 09-09-2002 11:26 AM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 08-21-2006
Nayanajith Nayanajith is offline
Registered User
  
 

Join Date: Nov 2005
Posts: 27
Auto answer ( Yes or No) from unix script

Dear All,

I have a backup script (in Unix), when executing the script need to give some answers.

eg - Do you want to backup - y


Like this i have to give Y and N for several questions.

So i want a script when executing this backup script to give Y and N automatically.

Help me to do this.


Thanks.
Nayanajith.
  #2 (permalink)  
Old 08-21-2006
nortypig nortypig is offline
Registered User
  
 

Join Date: Aug 2006
Location: Hobart Tasmania
Posts: 58
Is this the sort of case construct you are looking for?


Code:
echo "\n\n Would you like to say yes (y/n)?"
    read YN
    #
    case $YN in
    [yY]*) echo do something
	    ;;
    [nN]*) echo "Good. Bye for now.\n"
		exit 0
	    ;;
    esac
  #3 (permalink)  
Old 08-21-2006
Nayanajith Nayanajith is offline
Registered User
  
 

Join Date: Nov 2005
Posts: 27
Quote:
Originally Posted by nortypig
Is this the sort of case construct you are looking for?


Code:
echo "\n\n Would you like to say yes (y/n)?"
    read YN
    #
    case $YN in
    [yY]*) echo do something
	    ;;
    [nN]*) echo "Good. Bye for now.\n"
		exit 0
	    ;;
    esac
This is not what i want.

When back up script is running it is asking some questions.so i want to escape from those question.What i mean is i wanted to answer those questions automatically by another scripts.( I can not modify the original backup script..thats why)

Help me.

Nayanajith.
  #4 (permalink)  
Old 08-22-2006
sssow sssow is offline
Registered User
  
 

Join Date: Aug 2001
Posts: 179
look at this link

http://unix.com/showthread.php?t=30246
Closed Thread

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

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




All times are GMT -4. The time now is 02:53 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0