in reply to Re^2: capturing stderr of echo piped to a file
in thread capturing stderr of echo piped to a file
Perhaps you should just try it?
> { echo out; echo err >&2; } >f1 2>&1 > cat f1 out err > { echo out; echo err >&2; } 2>&1 >f1 err > cat f1 out
Redirection order definitely DOES matter in the shell. (Hmm, unless it's shell-specific? I'm using bash)
And just to do exactly what you said..
> 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
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.
In Section
Seekers of Perl Wisdom