Artificial intelligent assistant

How to inject keystrokes via a shell script? I'm trying to inject keystrokes into the input daemon so as to simulate typing from a Bash script. Is this possible, and if so, how can I make it happen?

If you are operating at the X level (as in Gilles' question), then use xdotool like so:


xdotool key KEYSTROKE_SPECIFIER


Where KEYSTROKE_SPECIFIER can be something like "a" or "F2" or "control+j"

EDIT: I missed your response to Gilles' question, sorry. I'll leave this response here as a solution for the X-case.

xcX3v84RxoQ-4GxG32940ukFUIEgYdPy 0a20c725bcaa8518a7c220cc309efa48