Gentoo Archives: gentoo-user

From: Richard Fish <bigfish@××××××××××.org>
To: gentoo-user@l.g.o
Subject: Re: [gentoo-user] redirect
Date: Fri, 21 Jul 2006 22:50:24
Message-Id: 7573e9640607211543h449e222dwd559550852ce0bac@mail.gmail.com
In Reply to: [gentoo-user] redirect by James Lockie
1 On 7/21/06, James Lockie <bjlockie@××××××.ca> wrote:
2 > How do I redirect the error from an emerge?
3 > I did 'emerge system 2>&1 >t' and that does most of it but it misses the
4 > actual error message.
5
6 2>&1 >foo is the wrong syntax for what you want. This first copies
7 stderr to stdout, and the second part redirects stdout to a file, but
8 stderr is still going to the file descriptor that stdout originally
9 refered to. It is logically the equivalent of:
10
11 stdout=1
12 stderr=2
13 stderr=$stdout
14 stdout=foo
15 echo $stderr
16
17 The correct syntax is ">foo 2>&1", which does the logical equivalent of:
18
19 stdout=1
20 stderr=2
21 stdout=foo
22 stderr=$stdout
23
24 HTH,
25 -Richard
26 --
27 gentoo-user@g.o mailing list

Replies

Subject Author
Re: [gentoo-user] redirect Neil Bothwick <neil@××××××××××.uk>