title: Force flushing from inside bash script code to a stdout file
body: <p>I'm trying to flush to stdout the output of a bioinformatic software written on Python code (Ete-Toolkit software). I tried the command (stdbuf) detailed on <a href="https://stackoverflow.com/questions/1429951/force-flushing-of-output-to-a-file-while-bash-script-is-still-running">Force flushing of output to a file while bash script is still running</a> but does not work because I have seen that stdbuf command it's only possible to execute from shell and not from bash(<a href="https://stackoverflow.com/questions/35348559/how-to-use-stdbuf-on-a-bash-function">How to use stdbuf on a bash function</a>).</p>
  <p>Moreover from Python I discovered the following function that maybe could be interesting:</p>
  <pre><code>import sys
  sys.stdout.flush()
  </code></pre>
  <p>But I don't know how can I implement inside the next bash script attached below.</p>
  <p>The purpose is that if I only use the options -o and -e in the bash script (as you can see) the output is printed to logs_40markers in a not continuos manner which does not permits me to see the error. I can do it working directly from shell but my internet connection is not stable and practically each night there are a power outage and I have to restart again the command that will takes minimun one week.</p>
  <pre><code>#!/bin/bash
  #$ -N tree
  #$ -o logs_40markers
  #$ -e logs_40markers
  #$ -q all.q@compute-0-3
  #$ -l mf=100G
  
  stdbuf -oL
  
  module load apps/etetoolkit-3.1.2
  
  export QT_QPA_PLATFORM='offscreen'
  
  ete3 build -w mafft_default-none-none-none -m sptree_fasttree_all -o provaflush --cogs coglist_species_filtered.txt -a multifasta_speciesunique.fa  --clearall --cpu 40 
  
  &amp;&gt; logs_40markers
  </code></pre>
  <p>Thanks on advance if someone can give me some guide/advice,</p>
  <p>Have a nice day,</p>
  <p>Thank you,</p>
  <p>Maggi</p>