The UNIX and Linux Forums  

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 here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Command to accept input rexmabry UNIX for Dummies Questions & Answers 3 02-08-2008 07:56 AM
Help-prompt for path and take this as input in find command bsandeep_80 UNIX for Advanced & Expert Users 6 01-03-2008 03:16 AM
Can give the input to prompt using shell script Vaibhav Agarwal Shell Programming and Scripting 2 10-31-2007 11:26 PM
Accept input parameters lloydnwo Shell Programming and Scripting 2 09-14-2004 04:47 AM
Accept user input - only numbers pvar Shell Programming and Scripting 1 02-10-2004 07:10 AM

Reply
 
Submit Tools LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 09-27-2005
Registered User
 

Join Date: Sep 2005
Posts: 14
Stumble this Post!
How to prompt for input & accept input in ONE line

hi,
am a new learner to shell programming.

i have a script which will prompt for user to key in their name & display their name afterwards.

script
=====
echo "Pls enter your name:"
read name
echo "Your name is $name."

output
=====
Pls enter your name:
Bob
Your name is Bob.

what are the modification to be done to the script in order for me to generate out the below output? (to accept the input in the SIMILAR line with the prompt, instead of the next line)

output
=====
Pls enter your name: Bob
Your name is Bob.

ur help is much appreciated.
Thanks in advanced.
Reply With Quote
Forum Sponsor
  #2 (permalink)  
Old 09-27-2005
RishiPahuja's Avatar
Registered User
 

Join Date: Apr 2005
Location: Bangalore, India
Posts: 203
Stumble this Post!
Thumbs up

Quote:
echo "Pls enter your name:"
read name
echo "Your name is $name."
Change it to:

Code:
echo "Pls enter your name:\c"
read name
echo "Your name is $name."

regards,
rishi
Reply With Quote
  #3 (permalink)  
Old 09-27-2005
Registered User
 

Join Date: Sep 2005
Posts: 14
Stumble this Post!
Thank you very much, rishi.
appreciate ur prompt reply.
Reply With Quote
Google The UNIX and Linux Forums
Reply

Thread Tools
Display Modes




All times are GMT -7. The time now is 11:39 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
The UNIX and Linux Forums Content Copyright ©1993-2008 The CEP Blog All Rights Reserved -Ad Management by RedTyger Visit The Global Fact Book

Content Relevant URLs by vBSEO 3.2.0