Unix/Linux Go Back    


Shell Programming and Scripting Unix shell scripting - KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and shell scripts and shell scripting languages here.

Provide 2 inputs when prompts

Shell Programming and Scripting


Tags
bash, input output

Closed Linux or Unix Question    
 
Thread Tools Search this Thread Display Modes
    #1  
Old Unix and Linux 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 Unix and Linux 10-15-2013
hergp hergp is offline Forum Advisor  
Problem Eliminator
 
Join Date: Jan 2010
Last Activity: 20 April 2015, 2:58 PM EDT
Location: Vienna, Austria
Posts: 812
Thanks: 19
Thanked 174 Times in 156 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 Linux or Unix Question

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Unix or Linux Image 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 04:16 AM.