At this stage I was only trying to print in the same spot on screen. Dennis has come up with code that works.
Malcolm
At this stage I was only trying to print in the same spot on screen. Dennis has come up with code that works.
Malcolm
When updating a value you are displaying, don't forget to consider formatting of the result. If your numbers change from 3 digits to 2 digits for example, the last digit of the previous value won't be overwritten unless you use a fixed width format with spaces in front for shorter numbers.
Am 21.10.2017 um 22:04 schrieb T M Smith:
you mean something like
watch ls -la
or
watch df -h
or if you want to watch something changeing
watch date
To stop press ctrl-c
Thanks for making that point Rick. And thanks to everyone who contributed.
Malcolm Smith
There's one point that wasn't noted in all the above... You need to aake sure the line being printed always has the same length (as was in fact the case in the example). Otherwise you'll get garbage left on the right. Simple solution -- add enough trailing spaces to cover all cases...
-- Pete --
Actually it was menti> When updating a value you are displaying, don't forget to consider
Perhaps, but the "trailing spaces" solution is more general-purpose.
But then the number jumps around as the length changes. It's perfectly normal for the higher digits to disappear when they are zero. It's very disturbing to watch the numbers jump around on the screen.
Have something to add? Share your thoughts — no account required.
Ask the community — no account required