From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 8246 invoked by alias); 18 May 2011 05:20:46 -0000 Mailing-List: contact zsh-users-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Users List List-Post: List-Help: X-Seq: 16038 Received: (qmail 4166 invoked from network); 18 May 2011 05:20:34 -0000 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-2.7 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,RCVD_IN_DNSWL_LOW autolearn=ham version=3.3.1 Received-SPF: pass (ns1.primenet.com.au: SPF record at _spf.google.com designates 209.85.216.171 as permitted sender) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:in-reply-to:references:date :message-id:subject:from:to:content-type:content-transfer-encoding; bh=eWkvPvjx1zF+Zd91sud5fqA+7lBwQ2ToMNx5w+2swIU=; b=Y6O1Td1Ycsrq4eMZ/LcOJxDFdRUJxUUyvEefR38IiHqzynScd4Z63OsAHK8xvQtT2A GpUmq9gGKBXgvpr02PDhATcBXDdPdOucRLVveNsQuGxsEvDGRt65dY4okfSGPdMrYQDo Kes/L9uh5EXBPgLSr9j50L49JzOYv16BBa6yU= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type:content-transfer-encoding; b=oHJGKkmIsD/ssVIzpwq49U4Rn5TvGmS8BPCWIsgCkoXoSJwx5F8hVhQF/Sy1ejgAHC Z6I3nz4kST6FJsfi2GIMb9HInsgfizxnriGfDvZvuqhORsQOAGr8xrR4BPbG4aRBA2Yu 1uVi/k+cBbKbjMklQqx8SKq7PCq+NdnNkXqO8= MIME-Version: 1.0 In-Reply-To: <110517195642.ZM16352@torch.brasslantern.com> References: <11397254-2D05-4778-8FFC-EA2CCAEA040F@uni-ulm.de> <110517195642.ZM16352@torch.brasslantern.com> Date: Wed, 18 May 2011 01:13:09 -0400 Message-ID: Subject: Re: Mixing and multiple redirection of stderr/stdout From: Aaron Davies To: "zsh-users@zsh.org" Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable On Tuesday, May 17, 2011, Bart Schaefer 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". =A0This is done without destroying one of the original streams > in the way that happens when you use "2>&1". =A0So: > > 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. --=20 Aaron Davies aaron.davies@gmail.com