I have a function that outputs on stdout as well as on stderr. E.g.
function test(){
echo "out"
echo "err" >&2
}
Now, calling this function, who can I redirect both output pipes to different bash variables? So it should work as the following line
f=`tempfile`
x=`test 2>"$f"`
y=`cat "$f"`
but without having to redirect on pipe into a file. Thanks a lot in advance!