I need to send keystrokes virtually to a terminal program (like vi or emacs).
I want to do something like this:
echo -e 'iHello, world!\e' | vi
and then have a vi session open with this buffer:
Hello, world! ~ ~ ~ ~ ~
But that does not work as vi does not read keystrokes through stdin.
I get this error:
ex/vi: Vi's standard input and output must be a terminal
How can I send some text string to a terminal program as if the string was typed directly on a keyboard?