If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Data Access, Manipulation & Batch Languages > Unix Shell Scripts > NEWBI read question

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 03-16-04, 09:24
Micster Micster is offline
Registered User
 
Join Date: Feb 2004
Posts: 5
NEWBI read question

How do i make my read be on the same line as the prompt? Here is my sample code:

#!/usr/bin/sh
opt='1'
while test "$opt" != "Q"
do
clear
echo '1) Option'
echo '2) Option'
echo '3) Option'
echo '4) Option'
echo ''
echo 'Enter your option now or Q ot quit >'
read opt
done

This puts the read on the line below the echo but I want it after the angle bracket. Sorry to bother your ubernesses with trival code, but thanks if you reply.
Reply With Quote
  #2 (permalink)  
Old 03-16-04, 10:25
aigles aigles is offline
Registered User
 
Join Date: Jan 2004
Location: Bordeaux, France
Posts: 319
Try this :
Code:
echo -n 'Enter your option now or Q ot quit >'
and if this doesn't work (UNIX flavour dependant)
Code:
echo "Enter your option now or Q ot quit >\c"
__________________
Jean-Pierre.
Reply With Quote
  #3 (permalink)  
Old 03-16-04, 10:40
Micster Micster is offline
Registered User
 
Join Date: Feb 2004
Posts: 5
Worked like a champ thanks.
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On