Re: One file for "stout+sterror" and another for "sterror"; it's possible?
2008-03-14, 16:13(+00), luciosan:
[...]
>>> { cmd 2>&1 >&3 | tee -a error.log >&3; } 3>> log.txt
> I tried your command, but the log.txt file contains sterror and stout
> not in order.In other words, I wrote a script to generate:
> 1->error
> 1->out
> 2->error
> 2->out
> 3->error
> 3->out
> 4->error
> 4->out
>
> and I've redirect the error in sterror and in a file (error.log); and
> sterror+stout in another file (out.log)
>
> The result is:
[...]
> but "cat out.log" contains
> 1->out
> 2->out
> 3->out
> 4->out
> 1->error
> 2->error
> 3->error
> 4->error
>
> As you can see, the out.log contains sterror+stout but not in order.
[...]
Above, you have too applications running concurrently (cmd and
tee) and writing to a same file. There's little chance that
you'll have them synchronise themselves so as to get the order
you wish.
Note that I forgot to mention zsh:
setopt mult_ios
cmd > log.txt 2>&1 2> error.log
But you're likely to have the same problem. Here, the teeing is
performed internally by zsh.
--
Stéphane
|