title: Redirecting output from a function block to a file in Linux
body: <p>Just like we redirect output from a for loop block to a file</p>
  
  <pre><code>for ()
  do
    //do something
    //print logs
  done &gt;&gt; output file
  </code></pre>
  
  <p>Similarly in shell script, is there a way to redirect output from a function block to a file, something like this?</p>
  
  <pre><code>function initialize {
           //do something
           //print something
  } &gt;&gt; output file
  
  //call initialize
  </code></pre>
  
  <p>If not, is there some other way I can achieve that? Please note my function has lot of messages to be printed in a log. Redirecting output to a file at every line would result in a lot of I/O utilization.</p>