From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 23734 invoked by alias); 30 Mar 2012 07:16:06 -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: 16936 Received: (qmail 11085 invoked from network); 30 Mar 2012 07:16:02 -0000 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-2.5 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_LOW,T_DKIM_INVALID autolearn=ham version=3.3.2 Received-SPF: pass (ns1.primenet.com.au: SPF record at _spf.google.com designates 209.85.160.43 as permitted sender) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type :content-transfer-encoding; bh=MMHpdzV8fOyG4cC2zLI9H4hgQaKj9PzUXbd7z9hBdcE=; b=xptANpW0JuWc99TPqHcTkMcj9HF+OIeCqWALvg++LX18OaXa0eAr3Pv2BLvgLdqhAz 9ObhXjpvickFm2K7ZVAMVkj3+Rd4uVx0MyP3nf+TAO1Tv+GwhoJ6f2fVSk3ryGv4ugEH VsOLC5PDi5xvD0tjkla0LFmmGjove0+pPRSAgxF80ZBJbNKiIHWXrp7ww6Zv9xyJNpje z6zsob0l3LPhUNuoneitr5Qb01YwKZUpGDxwrJr+KU0W1+R3XVwEb++XmJ4qRgvfFDXH 4HiCFK7znl+CqMv/moWTfgl0NmK9Ye0R8BJr3dqwfGOAxOKujXMBgOjoHn5UoK6L3Ftl CAvA== MIME-Version: 1.0 Sender: nikolai.weibull@gmail.com In-Reply-To: <120308065332.ZM14313@torch.brasslantern.com> References: <1331054185.27052.19.camel@air.fifi.org> <120306230111.ZM11639@torch.brasslantern.com> <120308065332.ZM14313@torch.brasslantern.com> Date: Fri, 30 Mar 2012 09:15:57 +0200 X-Google-Sender-Auth: aGS6lizqjytdBZXny6LBObn10YA Message-ID: Subject: Re: Is it possible to capture stdout and stderr to separate variables in Zsh? From: Nikolai Weibull To: Bart Schaefer Cc: Zsh Users Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable On Thu, Mar 8, 2012 at 15:53, Bart Schaefer wro= te: > On Mar 7, 10:26am, Nikolai Weibull wrote: > } > } outs=3D("${(@0):-"$({ out=3D$(x) } 2>&1; print $'\0'$out$'\0'$status)"}= ") > > That's nice. =C2=A0You can solve the problem that Philippe mentioned with > loss of trailing newlines, by embedding one NUL in $out like so: > > outs=3D("${(@0):-"$({ out=3D"$(x; print -n $'\0')" } 2>&1; > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0prin= t $'\0'$out$status)"}") That will, however, override the value of $status.