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

bash, input output

Closed Linux or Unix Question    
Thread Tools Search this Thread Display Modes
Old Unix and Linux 10-15-2013
prasanna2166 prasanna2166 is offline
Registered User
Join Date: Oct 2013
Last Activity: 20 August 2015, 5:50 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
Old Unix and Linux 10-15-2013
hergp hergp is offline Forum Advisor  
Problem Eliminator
Join Date: Jan 2010
Last Activity: 30 November 2015, 1:50 AM EST
Location: Vienna, Austria
Posts: 826
Thanks: 20
Thanked 180 Times in 162 Posts
You can either ask for them one by one, like:

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

or you can read them both at once.

echo -n Enter two values, separated by blanks:

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

Linux 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 08:31 AM
working in different prompts gopsman Shell Programming and Scripting 3 08-30-2007 07:12 AM
password prompts balag UNIX for Advanced & Expert Users 2 01-05-2006 02:19 PM
scripting password prompts hcclnoodles Shell Programming and Scripting 3 03-21-2005 04:25 PM
rsh help with remote prompts ianf Shell Programming and Scripting 4 09-02-2002 11:55 AM

All times are GMT -4. The time now is 09:25 AM.