bash : stderr & more (pipe for stderr)

Randall R Schulz rschulz@sonic.net
Sat Jun 14 22:07:00 GMT 2003


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 2>stderr-redirect

# Redirect standard error and out together
% cmd >stdout-redirect 2>&1

# Merge standard error with standard out and pipe
% cmd 2>&1 |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/



More information about the Cygwin mailing list