Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

special output help needed.

Status
Not open for further replies.

pavNell

Technical User
Sep 27, 2002
178
US
using the RANDOM number generator in korn shell, I'd like to produce the following output


Number: x

where x is "refreshed" every second with a new random number. The only output that I'm able to come up with is..

Number: x
Number: x
Number: x
etc, etc... and this is no good. Thanks for any help.

 
something to start with:
#!/bin/ksh

RANDOM=1

while :
do
echo "Number: ${RANDOM}"
sleep 1
done;
vlad
+---------------------------+
|#include<disclaimer.h> |
+---------------------------+
 
thanks vlad... but that that has the output like...

Number: x
Number: x
Number: x
...

I'd like output to be something like...

--A Nice Header--
Number: x

Number Count: y


where x and y are &quot;refreshed&quot; with new values. Not printing new lines.
Just need to know how to output the &quot;refreshed&quot; values. Not necessarely how to generate random numbers or counts. Thanks.
 
ok - this a different question then.
I suggest you look into 'tput'.
Unfortunately I don't have access to man pages right now. vlad
+---------------------------+
|#include<disclaimer.h> |
+---------------------------+
 
Hi,
Vgersh99 is correct, tput is the answer, i.e. tput cup 3 5 to position the cursor at line 3 column 5 before you echo the number.
 
In addition to 'man tput', also 'man terminfo' to find out all the goodies available to tput. Here are just a few:

tput cup <row> <col>
tput civis
tput clear
tput ed
tput el
tput bel Cheers,
ND [smile]

bigoldbulldog@hotmail.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top