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 08: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 04:16 AM
Can give the input to prompt using shell script Vaibhav Agarwal Shell Programming and Scripting 2 11-01-2007 12:26 AM
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 08:10 AM

Reply
 
Submit Tools LinkBack Thread Tools Search this Thread Display Modes
  #1  
Old 09-27-2005
Registered User
 

Join Date: Sep 2005
Posts: 14
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  
Old 09-27-2005
RishiPahuja's Avatar
Registered User
 

Join Date: Apr 2005
Location: Bangalore, India
Posts: 203
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  
Old 09-27-2005
Registered User
 

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

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes




All times are GMT -7. The time now is 10:15 AM.


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

Content Relevant URLs by vBSEO 3.2.0