How to programatically feed top with key strokes
Hi fellow forumers,
I'm writing a simple bash script and I would like it to be able to to execute top (that's the easy part) and then to supply the parameters to top programatically. Here is the explanation: Top is an interactive program that requires user input to do stuff, sort etc. I would like to programatically do so, for example: top; supply input; get info; quit; Is it possible with simple bash? Regards |
Hi,
You are aware that top (tries to) read /etc/toprc and ~/.toprc? If the parameters you want to give to top are always the same you could consider creating a ~/.toprc (start top, set all the options and press W). I'm not 100% sure, but I don't think you can feed top any options once it is up and running. Hope this helps. |
Quote:
Code:
#!/bin/bash 1[newline feed] If you reproduce the thingy in normal terminal: Code:
top -p $PIDOFJAVA I want to be able to do that programatically, so user input is not required |
Will
Code:
top -b ... |
Quote:
O M G?! answer your question. |
All times are GMT -5. The time now is 11:38 AM. |