delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2001/07/05/19:19:30

Mailing-List: contact cygwin-help AT sourceware DOT cygnus DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe AT sources DOT redhat DOT com>
List-Archive: <http://sources.redhat.com/ml/cygwin/>
List-Post: <mailto:cygwin AT sources DOT redhat DOT com>
List-Help: <mailto:cygwin-help AT sources DOT redhat DOT com>, <http://sources.redhat.com/ml/#faqs>
Sender: cygwin-owner AT sources DOT redhat DOT com
Delivered-To: mailing list cygwin AT sources DOT redhat DOT com
Message-ID: <3B44F1B6.3090409@Interwoven.com>
Date: Thu, 05 Jul 2001 16:01:10 -0700
From: Sandeep Tamhankar <sandman AT Interwoven DOT com>
User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:0.9.2) Gecko/20010701
X-Accept-Language: en-us
MIME-Version: 1.0
To: "Karr, David" <david DOT karr AT cacheflow DOT com>
CC: "'cygwin AT cygwin DOT com'" <cygwin AT cygwin DOT com>
Subject: Re: Pipe "make" stdout and stderr to process?
References: <2C08D4EECBDED41184BB00D0B74733420473EDEE AT exchanger DOT cacheflow DOT com>
X-AntiVirus: scanned for viruses by Interwoven Virus scanner (http://www.interwoven.com)

You want:

make 2>&1 | filterprog

You want the redirection of stderr->stdout to apply to your first 
command and send the resulting stdout to the second command.

What's really fun is when you want to save stdout and stderr to a file 
AND print them to the screen.  That's what the tee program is for (it 
takes its stdin and writes it to stdout and a file).  So when I'm 
building something I'll often do something like this:

make 2>&1 | tee make.out

That way I can see that all's going well and know that there's a log 
file I can refer to later.  Although another way to accomplish the same 
thing is to just do

make > make.out 2>&1
tail -f make.out

The problem there is that I often get confused about whether the 2>&1 
should come before or after the > make.out.  I know the first way works, 
so I always do that.

-Sandeep

Karr, David wrote:

> How do I run "make" so I can pass both stdout and stderr to a filtering
> process?  I'm familiar with writing the output to a file, taking both stdout
> and stderr ("make > make.out 2>&1"), but I don't see how to get this to work
> if I just want to pipe the output (both stdout and stderr) to another
> process.  When I do "make | filterprog 2>&1", it seems to have no effect, in
> that it appears as if the stderr from "make" goes directly to the console.
>>From reading the "bash" man page, it almost seems as if redirection doesn't
> apply to piping.
> 
> --
> Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
> Bug reporting:         http://cygwin.com/bugs.html
> Documentation:         http://cygwin.com/docs.html
> FAQ:                   http://cygwin.com/faq/
> 
> 


-- 
---------------------------------------------
Sandeep V. Tamhankar			
Member of Technical Staff		
Tel: (408) 220-7505
Fax: (408) 774-2002
Email: sandman AT interwoven DOT com

Visit http://www.interwoven.com
Moving Business to the Web	


--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Bug reporting:         http://cygwin.com/bugs.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019