| stdmux - Multiplex the given command's STDOUT and STDERR by prefixing lines |
stdmux - Multiplex the given command's STDOUT and STDERR by prefixing lines
stdmux [-o STDOUT_PREFIX | -e STDERR_PREFIX] [--] COMMAND [ARGS]
TODO
stdmux(1) exits with the COMMAND's exit status.
mux_output=`stdmux command`
demux() { local prefix=$1; sed -ne "s/^$prefix//p"; }
output_text=`echo "$mux_output" | demux 1`
error_text=`echo "$mux_output" | demux 2`