Operating System - HP-UX
1833053 Members
2287 Online
110049 Solutions
New Discussion

How to simulate keyboard input ?

 
SOLVED
Go to solution
Augusto Vinhaes
Frequent Advisor

How to simulate keyboard input ?

Hi !

I have to launch an executable program that asks some strings from the keyboard, and I want to do it in background (without interaction). I've heard that there is an utility suitable to do it. Can you help me ?

Regards,
Augusto
Augusto
1 REPLY 1
A. Clay Stephenson
Acclaimed Contributor
Solution

Re: How to simulate keyboard input ?

Probably the most powerful tool is "expect" which can look for patterns in the output and supply input.

http://hpux.connect.org.uk/hppd/hpux/Tcl/expect-5.42/

However, for simple tasks all you need is to redirect stdin.

myscript.sh < myinputfile &

Another usefuk tools is the utility "script" which can record all terminal input and output and make the above tasks easier. Man script for details.
If it ain't broke, I can fix that.