Provide 2 inputs when prompts | Unix Linux Forums | Shell Programming and Scripting

  Go Back    


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

Provide 2 inputs when prompts

Shell Programming and Scripting


Tags
bash, input output

Closed Thread    
 
Thread Tools Search this Thread Display Modes
    #1  
Old 10-15-2013
prasanna2166 prasanna2166 is offline
Registered User
 
Join Date: Oct 2013
Last Activity: 27 March 2014, 5:51 AM EDT
Location: chennai
Posts: 14
Thanks: 5
Thanked 0 Times in 0 Posts
Provide 2 inputs when prompts

Hi All,

I am a novice to UNIX, i need to know is there a way to provide 2 inputs when the shell prompts and i need to assign those 2 values to 2 separate variables. I dont want to give those values as a arguments (while running the script).

Thanks in advance!!
Sponsored Links
    #2  
Old 10-15-2013
hergp hergp is offline Forum Advisor  
Problem Eliminator
 
Join Date: Jan 2010
Last Activity: 31 August 2014, 9:55 AM EDT
Location: Vienna, Austria
Posts: 796
Thanks: 18
Thanked 167 Times in 149 Posts
You can either ask for them one by one, like:

Code:
echo -n Please enter first value:
read VALUE1
echo -n Please enter second value:
read VALUE2

or you can read them both at once.

Code:
echo -n Enter two values, separated by blanks:
read VALUE1 VALUE2

The Following User Says Thank You to hergp For This Useful Post:
prasanna2166 (10-15-2013)
Sponsored Links
Closed Thread

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Deleting a file prompts for a Yes or No chipahoys AIX 1 03-26-2009 07:31 AM
working in different prompts gopsman Shell Programming and Scripting 3 08-30-2007 06:12 AM
password prompts balag UNIX for Advanced & Expert Users 2 01-05-2006 01:19 PM
scripting password prompts hcclnoodles Shell Programming and Scripting 3 03-21-2005 03:25 PM
rsh help with remote prompts ianf Shell Programming and Scripting 4 09-02-2002 10:55 AM



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