Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: Mixing and multiple redirection of stderr/stdout



On Tuesday, May 17, 2011, Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx> wrote:

> The next trick is that zsh has a shorthand operator ">&" (no numbers
> around it) that means "redirect both stdout and stderr at the same
> time".  This is done without destroying one of the original streams
> in the way that happens when you use "2>&1".  So:
>
> torch% script >&file_mix >file_out 2>file_err
> file_out:STDOUT
> file_mix:STDOUT
> file_mix:STDERR
> file_err:STDERR
>
> And there you are.

Relatedly, can these (or any other) redirections guarantee the same
interleaving of stdout and stderr that would be produced on the
console with no redirections? I've often seen (mostly in other shells,
iirc) that a process which would have, e.g., alternating prints to out
and err, is captured to file as one long block of out followed by one
long block of err.

-- 
Aaron Davies
aaron.davies@xxxxxxxxx



Messages sorted by: Reverse Date, Date, Thread, Author