From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 17069 invoked by alias); 14 Nov 2015 18:59:28 -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: 20956 Received: (qmail 1144 invoked from network); 14 Nov 2015 18:59:25 -0000 X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.0 X-Authority-Analysis: v=2.1 cv=X+5rdgje c=1 sm=1 tr=0 a=2HRJbREI7CNh35z1D4ZSNQ==:117 a=2HRJbREI7CNh35z1D4ZSNQ==:17 a=N659UExz7-8A:10 a=vZNzWvr6uX5cb-l0QAUA:9 a=pILNOxqGKmIA:10 Message-id: <5647848B.7060506@eastlink.ca> Date: Sat, 14 Nov 2015 10:59:23 -0800 From: Ray Andrews User-Agent: Mozilla/5.0 (X11; Linux i686; rv:31.0) Gecko/20100101 Icedove/31.7.0 MIME-version: 1.0 To: zsh-users@zsh.org Subject: Re: capturing stderr to variable. References: <5646B5F8.3090702@eastlink.ca> <151114000101.ZM611@torch.brasslantern.com> <56476D72.6010006@eastlink.ca> In-reply-to: <56476D72.6010006@eastlink.ca> Content-type: text/plain; charset=windows-1252; format=flowed Content-transfer-encoding: 7bit On 11/14/2015 09:20 AM, Ray Andrews wrote: > > >> { highlight ... >/dev/tty } 2>&1 | read highlight_err >> # now $highlight_err has the first line of stderr >> # (this does not work in most shells other than zsh) >> >> > > And it's even simpler in case the output is to be captured and not echoed to stdout at all: body_list=( ${(@f)"$( highlight $filename )"} ) 2>&1 | read _err If I do: body_list=( ${(@f)"$( highlight $filename > /dev/tty )"} ) 2>&1 | read _err ... I get the output to screen, so that answers my previous question. The syntactic logic might be harder than Finnish, but it *is* there.