Unix/Linux Go Back    

Shell Programming and Scripting BSD, Linux, and UNIX shell scripting Post awk, bash, csh, ksh, perl, php, python, sed, sh, shell scripts, and other shell scripting languages questions here.

Provide 2 inputs when prompts

Shell Programming and Scripting

bash, input output

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: 24 October 2016, 6:14 AM EDT
Location: Vienna, Austria
Posts: 844
Thanks: 26
Thanked 191 Times in 170 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

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 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 08:36 PM.