title: Error redirect to output stream failed while echo to file. why?
body: <pre><code>res=`echo "hello" &gt; /home/directory/folder1/xxx.txt 2&gt;&amp;1`
  </code></pre>
  
  <p>/home/directory/folder1/xxx.txt: Permission denied</p>
  
  <pre><code>echo $res
  </code></pre>
  
  <p>EMPTY LINE</p>
  
  <p>i expect the error to be stored in the variable res , why it is not getting stored and what to do for having error stored in the variable ?</p>