title: Redirect stdout and stderr to Function
body: <p>I need help sending the output (stdin and stdout) from system commands to a bash function, while still accepting input from arguments. Something like the example that follows. Can someone point me down the right road?</p>
  
  <pre><code>LogMsg()
  {
    DateTime=`date "+%Y/%m/%d %H:%M:%S"`
    echo '*****'$DateTime' ('$QMAKESPEC'): '$1 &gt;&gt; "$LogFile"
    echo $DateTime' ('$QMAKESPEC'): '$1
  }
  
  # Already works
  LogMsg "This statement is sent directly"
  
  # Wish I could do this:
  # Capture both stdout &amp; stderr of a system function to the logfile
  # I do not presume that any of the syntax that follows is good
  make 2&gt;&amp;1 &gt;(LogMsg)
  </code></pre>