I have a process that runs indefinitely until a key is pressed. I would like to use bash to inject a keystroke into this process to have it terminate. Based on this post, linux - write commands from one terminal to another I have tried to use
echo -e "b" > /proc/[pid]/fd/0
(The letter "b" in this case is just arbitrary) The letter "b" will show up in the terminal of the process that is running indefinitely, but it doesn't trigger the termination of the program like it does if I actually type "b" into the window.
I have also seen the recommendation for xdotools, but I couldn't get it to work and am trying to stay away from relying on GUI for implementing this.
I am running Ubuntu 10.04, and I don't have much experience in bash.