Sending keystroke through script.

Posted on 2009-02-12
Medium Priority
Last Modified: 2013-11-10

I need help sending a keystroke from a shell script. My script telnets into a server's serial console. I have this part down. Then I need to send the keystroke combination "Esc+(" to redirect me to the server's iLo/BMC interface. (I need to simulate pressing the keystroke for opening parenthesis while the Escape key is depressed) I don't know how to send keystrokes from a simple linux script. I am not allowed to install any new packages and would really like to keep this as a script and not a c program. I don't need the script to 'expect' anything, just send the keystroke.

Question by:zkolev
LVL 48

Accepted Solution

Tintin earned 2000 total points
ID: 23628909
You could try

(echo -e "\033(") | telnet server
LVL 35

Expert Comment

by:Duncan Roe
ID: 23631336
Is this in a GUI normally? X can detect arbitrary key press combinations, but there is no ASCII equivalent. If you touch the Escape key, you will get an Ec (033) character. If you hold it down, you may get many depending on your console settings: whether key repeat is on and what is the frequency. If in the meantime you press "(", you may get one, interspersed with the escapes.
In brief, you can't send key press events to a serial console.

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Make the most of your online learning experience.
We live in a world of interfaces like the one in the title picture. VBA also allows to use interfaces which offers a lot of possibilities. This article describes how to use interfaces in VBA and how to work around their bugs.
With the power of JIRA, there's an unlimited number of ways you can customize it, use it and benefit from it. With that in mind, there's bound to be things that I wasn't able to cover in this course. With this summary we'll look at some places to go…
Starting up a Project

809 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question