bash : stderr more (pipe for stderr)

2003-06-14 Thread Alex Vinokur
=
Windows 2000
CYGWIN_NT-5.0 1.3.22(0.78/3/2)
GNU bash, version 2.05b.0(5)-release-(i686-pc-cygwin)
=

$ command | more # works only for stdout

$ command | more
bash: syntax error near unexpected token `'

How to use pipe for stderr?

Thanks,

   ==
   Alex Vinokur
 mailto:[EMAIL PROTECTED]
 http://www.simtel.net/pub/oth/19088.html
 http://sourceforge.net/users/alexvn
   ==








--
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/



RE: bash : stderr more (pipe for stderr)

2003-06-14 Thread Hannu E K Nevalainen \(garbage mail\)
 From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] 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 ((argc1)  (argv[1][0]=='o'))
  fprintf(stdout,%s: This text on stdout\n,argv[0]);

if ((argc2)  (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-x1 Hannu   19876 Jun 14 13:02 a.exe*

$ a o e 21 | 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/



Re: bash : stderr more (pipe for stderr)

2003-06-14 Thread Randall R Schulz
Alex,

At 00:25 2003-06-14, Alex Vinokur wrote:

$ command | more # works only for stdout

$ command | more
bash: syntax error near unexpected token `'
How to use pipe for stderr?
BASH uses the Bourne and Korn shell syntax for redirection. You're 
using the CSH / tcsh variety.

# Redirect standard out and standard error separately
% cmd stdout-redirect 2stderr-redirect
# Redirect standard error and out together
% cmd stdout-redirect 21
# Merge standard error with standard out and pipe
% cmd 21 |cmd2
Randall Schulz


Thanks,

   Alex Vinokur


--
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/


Re: bash : stderr more (pipe for stderr)

2003-06-14 Thread Igor Pechtchanski
On Sat, 14 Jun 2003, Randall R Schulz wrote:

 Alex,

 At 00:25 2003-06-14, Alex Vinokur wrote:

 $ command | more # works only for stdout
 
 $ command | more
 bash: syntax error near unexpected token `'
 
 How to use pipe for stderr?

 BASH uses the Bourne and Korn shell syntax for redirection. You're
 using the CSH / tcsh variety.


 # Redirect standard out and standard error separately
 % cmd stdout-redirect 2stderr-redirect

 # Redirect standard error and out together
 % cmd stdout-redirect 21

 # Merge standard error with standard out and pipe
 % cmd 21 |cmd2

 Randall Schulz

Randall,

I'm probably being a smartass here, but you can also *swap* stdout and
stderr on redirection:

% cmd 32 21 13-

Hope this helps,
Igor
-- 
http://cs.nyu.edu/~pechtcha/
  |\  _,,,---,,_[EMAIL PROTECTED]
ZZZzz /,`.-'`'-.  ;-;;,_[EMAIL PROTECTED]
 |,4-  ) )-,_. ,\ (  `'-'   Igor Pechtchanski, Ph.D.
'---''(_/--'  `-'\_) fL a.k.a JaguaR-R-R-r-r-r-.-.-.  Meow!

I have since come to realize that being between your mentor and his route
to the bathroom is a major career booster.  -- Patrick Naughton


--
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/