Latest LQ Deal: Latest LQ Deals
Go Back > Forums > Linux Forums > Linux - Software
User Name
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.


  Search this Thread
Old 10-01-2011, 08:25 AM   #1
LQ Newbie
Registered: Sep 2009
Posts: 11

Rep: Reputation: 1
How to simulate keyboard input to a console application?

I have developed an application in bash that uses "whiptail" to display dialogs in a terminal. (I personnally don't like this kind of UI but i'm only a developer, i don't make decisions ...). Anyway, now i have to test it, and i would like to simulate a user that types values, press "Enter", "Echap", "Tab", "down arrow", "up arrow"

I didn't get expect working and it seems it is not possible (

There is no X on the machine, so xdotool cannot be used.

So, how can i test this kind of dialogs ? Is it possible to write to the process stdin and "make it believe" it receive input from the tty ? Or maybe by writing to a specific device in /dev ?

Old 10-01-2011, 01:33 PM   #2
Registered: Jan 2010
Location: Melbourne, IA, USA
Distribution: Ubuntu
Posts: 93

Rep: Reputation: 8
This may sound silly, but you could ssh in and automate the testing on the client machine.
Old 10-01-2011, 05:32 PM   #3
LQ Newbie
Registered: Sep 2009
Posts: 11

Original Poster
Rep: Reputation: 1
Yes, it's a good idea !

anyway, someone found the solution on stackoverflow:


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] Bash script to simulate keyboard entry? PaulFXH Linux - Desktop 5 02-11-2011 01:32 PM
grab keyboard in console application using qt npyadav Linux - Software 0 11-25-2010 02:27 AM
wine: keyboard input reaching terminal not application angelo_maci Linux - Software 2 06-17-2010 08:00 AM
usb keyboard as input for console driver prettysmurfed Linux - General 0 11-27-2007 08:02 AM
Repeated "input: AT Translated Set 2 keyboard as /class/input/input" messages AcerKev Mandriva 2 09-16-2007 09:35 AM > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 02:24 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration