note
Crackers2
<p>Perhaps you should just try it?</p>
<code>
> { echo out; echo err >&2; } >f1 2>&1
> cat f1
out
err
> { echo out; echo err >&2; } 2>&1 >f1
err
> cat f1
out
</code>
<p>Redirection order definitely DOES matter in the shell. (Hmm, unless it's shell-specific? I'm using bash)</p>
<p>And just to do exactly what you said..</p>
<code>
> perl -e'print "print\n"; warn "warn"' >f1 2>&1
> cat f1
warn at -e line 1.
print
> perl -e'print "print\n"; warn "warn"' 2>&1 >f1
warn at -e line 1.
> cat f1
print
</code>
<p>In the first case both print and warn go to the file, in the second case warn goes to stdout and print to the file.</p>
1105354
1105532