[TriLUG] colorize stderr in bash
porter at trilug.org
Wed Jul 23 17:49:10 EDT 2008
> I wonder if there's a way to pipe stderr to a program that adds
> escape sequences and sends it right back to stderr while
> leaving stdout intact.
In short, this is not going to work.
STDERR and STDOUT are going to be mixed onto the same terminal, not
following any clean pattern. Even if you went so far as to change the
color before and after every character in STDOUT, you'd still have problems.
For example, if you did [red]$CHAR[white] for all characters in STDOUT,
it might still get mixed like this:
some stderr: [red]A[white][red]B[white][red]C
some stdout: XYZ
You would need some way to tell the terminal how to combine the two
streams in an orderly way.
More information about the TriLUG