delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2003/06/14/07:49:33

Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sources.redhat.com/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sources.redhat.com/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com
From: "Hannu E K Nevalainen \(garbage mail\)" <garbage_collector AT telia DOT com>
To: "Alex Vinokur" <alexvn AT connect DOT to>, "ML CygWIN" <cygwin AT cygwin DOT com>
Subject: RE: bash : stderr & more (pipe for stderr)
Date: Sat, 14 Jun 2003 13:47:27 +0200
Message-ID: <NGBBLLIAMFLGJEOAJCCEOENCDAAA.garbage_collector@telia.com>
MIME-Version: 1.0
X-Priority: 3 (Normal)
X-MSMail-Priority: Normal
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165
In-Reply-To: <bceig2$2f3$1@main.gmane.org>
Importance: Normal

> From: cygwin-owner AT cygwin DOT com [mailto:cygwin-owner AT cygwin DOT com]On Behalf
> Of Alex Vinokur

> How to use pipe for stderr?

This is a Bash-question, not cygwin - i.e. off topic here ;-)


$ cat t.c 
#include <stdio.h>

int main(int argc, char **argv) {

  if (argc<=1)
    printf("Use: %s [o] [e]\n" \
           " o - print short text on stdout\n" \
           " e - print short text on stderr\n",argv[0]);
  else {

    if ((argc>1) && (argv[1][0]=='o'))
      fprintf(stdout,"%s: This text on stdout\n",argv[0]);
        
    if ((argc>2) && (argv[2][0]=='e'))
      fprintf(stderr,"%s: This text on stderr\n",argv[0]);
      
    }
    
return 0;
}
$ gcc t.c 
$ ls -l a.exe
-rwxr-xr-x    1 Hannu       19876 Jun 14 13:02 a.exe*

$ a o e 2>&1 | less

-- less display --
a: This text on stdout
a: This text on stderr
-- end --


/Hannu E K Nevalainen, 59~14'N, 17~12'E
 ~ <=> degree

-- 

--END OF MESSAGE-- 

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.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