title: Multiple variable assignment in a command
body: <p>I have a function that outputs on stdout as well as on stderr. E.g.</p>
  
  <pre><code>function test(){
     echo "out"
     echo "err" &gt;&amp;2
  }
  </code></pre>
  
  <p>Now, calling this function, who can I redirect both output pipes to different bash variables? So it should work as the following line</p>
  
  <pre><code>f=`tempfile`
  x=`test 2&gt;"$f"`
  y=`cat "$f"`
  </code></pre>
  
  <p>but without having to redirect on pipe into a file. Thanks a lot in advance!</p>