On Thu, Jul 07, 2011 at 02:59:37PM +0200, Matthias Kilian wrote:
Wouldn't it be better to either collect both stdout and stderr in
the same log file or to use three log files .err.log, .out.log and
.log, where the latter contains the combined streams? Otherwise you are
loosing the context between the two, which sometimes may be important.
Little bit difficult as it seems, so here's a simple version (without
the combined log). You can invoke it like this:
lilylog.sh o.log e.log ls -l . dontexist
which is the `verbose' mode (i.e. you still see stdout and stderr, but
both get logged to the given files) or like this:
lilylog.sh -q o.log e.log ls -l . dontexist
which is the `quiet' mode (output goes only to the files).
If the command given fails (exit code != 0) so does this script.
In addition, it writes (to stderr) the command that failed and the
logfiles.
Ciao,
Kili