This is the mail archive of the cygwin-xfree mailing list for the Cygwin XFree86 project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Saving all xterm output to a file


On Sun, Feb 8, 2009 at 6:35 AM, Thomas Dickey  wrote:
> hmm - yes (I had at hand a script which does the latter, and couldn't
> recall the detail needed for the former, which seemed to be what OP
> requested).

Redirects are processed left-to-right.  So this:

command >foo 2>&1

says "send stdout into file foo and then send stderr (file descriptor
2) wherever stdout (file descriptor 1) is going".  So they both go
into the file.  If you swap them, like this:

command 2>&1 >foo

that says "send stderr wherever stdout is going, and then send stdout
into file foo".  Which means stderr goes to the screen like usual and
the 2>&1 doesn't do much in this case.  But since pipes are set up
before any of the redirects, this command:

command 2>&1 >foo | othercommand

will send stdout into a file while piping stderr into the other
command, and this one:

command 2>&1 | othercommand

will pipe them both together.

-- 
Mark J. Reed <markjreed@gmail.com>

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://x.cygwin.com/docs/
FAQ:                   http://x.cygwin.com/docs/faq/


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]