title: Inject Keystroke to different process using Bash
body: <p>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, <a href="https://stackoverflow.com/questions/10376251/linux-write-commands-from-one-terminal-to-another">linux - write commands from one terminal to another</a> I have tried to use </p>
  
  <pre><code>echo -e "b" &gt; /proc/[pid]/fd/0
  </code></pre>
  
  <p>(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.</p>
  
  <p>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. </p>
  
  <p>I am running Ubuntu 10.04, and I don't have much experience in bash.</p>