Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I'm writing a bash script to gather some informations about disks and then start the 'nmon' tool to monitor only those specific disks.

I start the nmon tool out of the bash script (with -g). To get the correct view within the tool one need to press the g key on the keyboard.

Is there any way to get that keypress automatically triggered out of the bash script?

Thanks a lot!

share|improve this question

1 Answer 1

Try this:

echo -n "g" | nmon

For more infomation: http://stackoverflow.com/questions/6264596/simulating-enter-keypress-in-bash-script

Or use expect (man expect comes with examples).

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.