title: bash linux - write and read from stdin and stdout
body: <p>I have an application which I can run from the commonand line and it acts like a CLI for me.</p>
  
  <p>However its part of a suite of applications and now I want them all to run on boot up and so they are being started as a service (systemd).</p>
  
  <p>So all my apps includeing my CLI are running great. However I can't see the output of the CLI and I can't send commands to it.</p>
  
  <p>I was using the stdout to print the CLI screen - I guess I can work around this by outputting to a file - but it would be nice to get access to its stdout. The bigger issue is that I can't write to its stdin.</p>
  
  <p>I read this: <a href="https://serverfault.com/questions/188936/writing-to-stdin-of-background-process">writing-to-stdin-of-background-process</a> and tried to <code>echo -e "command\n" &gt; /proc/.../0</code>, but nothing happened - I checked the log of my CLI (gets written to a file) and it did not get the input.</p>
  
  <p>I then did a <code>ls -l</code> on <code>/proc/&lt;pid&gt;/fd/</code> and I notice that <code>0 --&gt; /dev/null</code> meaning stdin is linked to /dev/null. </p>
  
  <p>So, how can I get access to its stdin?</p>
  
  <p>Bonus question - is there a way to operate (in the same bash shell) such that I re-direct my stdin to the stdin of this process AND redirect the process stdout to my shell?</p>