This is the mail archive of the
cygwin@cygwin.com
mailing list for the Cygwin project.
RE: bash : stderr & more (pipe for stderr)
- 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>
- Date: Sat, 14 Jun 2003 13:47:27 +0200
- Subject: RE: bash : stderr & more (pipe for stderr)
> From: cygwin-owner@cygwin.com [mailto:cygwin-owner@cygwin.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/