我正在尝试在 Solaris 上使用 tee 命令将 1 个命令的输出路由到 2 个不同的流,每个流都包含多个语句。这是我编码的代码片段,但不起作用。此迭代引发有关文件意外结束的错误。如果我将 > 更改为 | 它在意外令牌附近抛出错误语法错误。
todaydir=/some/path
baselen=${#todaydir}
grep sometext $todaydir/somefiles*
while read iline
tee
>(
# this is the first block
do ojob=${iline:$baselen+1:8}
echo 'some text here' $ojob
done > firstoutfile
)
>(
# this is the 2nd block
do ojob=${iline:$baselen+1:8}
echo 'ls -l '$todaydir'/'$ojob'*'
done > secondoutfile
)
建议?