title: Need a way to temporarily redirect STDOUT
body: <p>I know how to redirect output in Linux.  Thing is, I have alot of output in my bash script and I don't want to type something like</p>
  
  <pre><code>echo $foo &gt;&gt; bar
  </code></pre>
  
  <p>over and over again.  I would much rather do something like:</p>
  
  <pre><code>hey, bash, for the time being put all your STDOUT in "bar"
  echo $foo
  .
  .
  OK, bash, you can go back to regular STDOUT now
  </code></pre>
  
  <p>I tried opening FD 1 as a file:</p>
  
  <pre><code>exec 1&gt;bar
  </code></pre>
  
  <p>but couldn't get STDOUT back to normal when I was done.  Closing the file</p>
  
  <pre><code>exec 1&gt;&amp;-
  </code></pre>
  
  <p>gave me errors that I couldn't get around.</p>
  
  <p>Any way to do this?  Thanks!</p>