命令

时间:2015-07-31 03:09:01

标签: bash

我有一个在stdout和stderr上输出的函数。 E.g。

function test(){
   echo "out"
   echo "err" >&2
}

现在,调用此函数,谁可以将两个输出管道重定向到不同的bash变量?所以它应该作为以下行

f=`tempfile`
x=`test 2>"$f"`
y=`cat "$f"`

但无需将管道重定向到文件中。非常感谢提前!

0 个答案:

没有答案
相关问题