PDA

View Full Version : "read" command


Erik-joix
2004-05-12, 05:17 PM CDT
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
2004-05-12, 05:38 PM CDT
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
2004-05-12, 05:44 PM CDT
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