[sf-lug] Fwd: stderr and stdout, merged in a single file, in different colors
embeddedlinuxguy at gmail.com
Sun Sep 28 15:30:56 PDT 2008
2008/9/28 Asheesh Laroia <asheesh at asheesh.org>:
> http://www.asheesh.org/note/software/stderred.html .
You are right about the buffering problem. The reason that timestamps
did not solve this in my Perl utility is that it applies the
timestamps after reading out of the pipe, rather than when the
messages go into the pipe. If there were an accounting facility in
Linux pipes which recorded the number of bytes written and a
timestamp, that could be used to interleave the messages.
The Zsh snippet is interesting in that it lets you send stderr to a
shell command using 2>> (that doesn't seem to work in Bash). It would
require some tweaking to solve the original problem because it assumes
output is going to /dev/tty and does not get redirected to a file.
More information about the sf-lug