user3395707
user3395707

Reputation: 67

how to use bash to write "TOP" like program?

I am trying to write a management utility like "TOP" to monitor some device. How can I use BASH to write something like "TOP" which means the output is dynamically refreshed and the new output will override the old output?

THanks!

Upvotes: 1

Views: 295

Answers (1)

hek2mgl
hek2mgl

Reputation: 158040

On Linux you can use the watch command:

watch /path/to/your_script.sh

Write your_script in a way that it runs just once, not in a loop. watch will call it periodically and update the screen instead of appending to the output.

Upvotes: 2

Related Questions