Post History
Using BASH, how can I redirect stdout and stderr each, to two separate files, simultaneously? That's a mouthful, let me clarify a little: I have a hypothetical script that may/will generate outpu...
#1: Initial revision
Capture separate _and_ combined stdout/stderr
Using BASH, how can I redirect stdout and stderr each, to two separate files, simultaneously? That's a mouthful, let me clarify a little: I have a hypothetical script that may/will generate output on both stdout and stderr. I want to run the script and wind up with three output files: 1. The contents of stdout only (`>stdout.txt`). 2. The contents of stderr only (`2>stderr.txt`). 3. The combined contents of stdout and stderr, interleaved as they would have been had they been printed to the terminal in real time (`>both.txt 2>both.txt`). With Zsh you can do something like this with `MULTIOS` enabled: ``` script.txt >stdout.txt >>both.txt 2>stderr.txt 2>>both.txt ``` ...but I need something that'll work on systems that don't have Zsh installed.