shell -top- like program
I would like to write a program to
display some variable info in shell like "top" program refreshing automaticly where can i view infos and simple examples to achieve this ? Thank you very much. |
You can make a little while loop which will execute some command (e.g. echoing the values of some shell variables), and then sleep for a few seconds before looping:
Code:
SLEEPTIME=3 |
like "top" program...
|
Top is a process and system resource monitor, so something which monitors shell variables is not really "like" top.
Please be more clear what you require. Assuming the permissions allow it and the proc filesystem is available on the system you are using, you can investigate the environment of another process using the /proc/[PID]/environ special file. Note that this does not include all shell variables - only those exported to the environment. |
ok an example:
put in the midlle of the screen a clock... |
take a look at watch command (man watch)
|
Quote:
|
in the midlle of the screen a clock
when i type "S" displays seconds when i type "s" hide seconds :-) |
Quote:
|
YES !
curses API ! i think thats it... ps: funny - the procinfo program that works like the same way top does donīt include curses... |
There are curses bindings for several languages. Take your pick. C, Python, Perl, TCL, PHP... I'm sure there are more.
|
Quote:
Code:
SLEEPTIME=3 |
All times are GMT -5. The time now is 09:36 AM. |