PDA

View Full Version : "read" command



Erik-joix
13th May 2004, 12:17 AM
Hi guys.
I put the read command in a script of mine in a while loop and everytime i enter something (a number) into the read variable (number), read, starts a new line but i want the cursor to stay at the same position or the text that is drawn to be drawn at the same place.


read -p "What's the number? " number

theurge
13th May 2004, 12:38 AM
I've always used something like this:



echo -n "(type YES or NO) : "
read userConfirm


I haven't dug into the options for the read command much, but that's how I accomplished what you want.

Erik-joix
13th May 2004, 12:44 AM
Originally posted by theurge
I've always used something like this:



echo -n "(type YES or NO) : "
read userConfirm


I haven't dug into the options for the read command much, but that's how I accomplished what you want.

Looks like that could work too. Thanks!
But i just figured out that this works also.

read -p "What's your choice? " choice; tput cuu1