title: on-the-fly output redirection, seeing the file redirection output while the program is still running
body: <p>If I use a command like this one:<br>
  ./program >> a.txt &amp;<br>
  , and the program is a long running one then I can only see the output once the program ended. That means I have no way of knowing if the computation is going well until it actually stops computing. I want to be able to read the redirected output on file while the program is running.</p>
  
  <p>This is similar to opening a file, appending to it, then closing it back after every writing. If the file is only closed at the end of the program then no data can be read on it until the program ends. The only redirection I know is similar to closing the file at the end of the program.</p>
  
  <p>You can test it with this little python script. The language doesn't matter. Any program that writes to standard output has the same problem.</p>
  
  <pre><code>l = range(0,100000)
  for i in l:
    if i%1000==0:
      print i
    for j in l:
      s = i + j
  </code></pre>
  
  <p>One can run this with:<br>
  ./python program.py >> a.txt &amp;<br>
  Then cat a.txt .. you will only get results once the script is done computing.</p>