bash: redirect stdout and stder to _different_ variables

Is it possible to redirect stdout and stderr to different variables in
bash? I do things like

error_file=$(mktemp)
out=$(<command> 2>$error_file)
err=$(< error_file)
rm $error_file

to get stdout in out and stderr in err when running <command>, but I'd
like to avoid the temp file if possible.

Thanks,

-nathan
Nathan Collins [ Di, 30 Oktober 2007 20:59 ] [ ID #1857406 ]
Linux » comp.unix.shell » bash: redirect stdout and stder to _different_ variables

Vorheriges Thema: Sed reqular expression question.
Nächstes Thema: zsh backspace headache