Send keystrokes to a process on Console

view full story

http://unix.stackexchange.com – If I have a terminal with a shell open, how can I write a shell script (any scripting language is ok with me!) that will send a keystroke to any one of the running processes? As an example, how could I call a function that sends Esc,:,wq,enter to the Vim process, assuming I know its PID? Is there an executable that could provide this API? Alternatively, could I do this with something like Tmux? (HowTos)