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.
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^4: capturing stderr of echo piped to a file
by boftx (Deacon) on Oct 29, 2014 at 19:26 UTC | |
by Crackers2 (Parson) on Oct 29, 2014 at 20:13 UTC | |
by boftx (Deacon) on Oct 29, 2014 at 23:21 UTC | |
by Crackers2 (Parson) on Oct 30, 2014 at 18:31 UTC |
In Section
Seekers of Perl Wisdom