<p>There seem to be two bash idioms for redirecting STDOUT and STDERR to a file:</p>

<pre><code>fooscript &amp;&gt; foo
</code></pre>

<p>... and ...</p>

<pre><code>fooscript &gt; foo 2&gt;&amp;1
</code></pre>

<p>What's the difference?  It seems to me that the first one is just a shortcut for the second one, but my coworker contends that the second one will produce no output even if there's an error with the initial redirect, whereas the first one will spit redirect errors to STDOUT.</p>

<p><strong>EDIT</strong>:  Okay... it seems like people are not understanding what I am asking, so I will try to clarify:</p>

<p>Can anyone give me an example where the two <em>specific lines</em> lines written above will yield different behavior?</p>

```
```
&> foo # Will take all and redirect all output to foo.

2>&1 # will redirect stderr to stdout.
```
```