X-Recipient: archive-cygwin AT delorie DOT com DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:reply-to:subject:references:to:from:message-id :date:mime-version:in-reply-to:content-type :content-transfer-encoding; q=dns; s=default; b=MmW6GOr7MYLeqAjP 2pP23Pz7nLGurCrSC8dAvRfp/b7oJ3IQfY2JhsXcRaST37s1BkHmtfDlr10nET5r TlRha361Z/bkL3llPH7C82mrbBDAZRo59Sgv+6wPXjvL4wA7/EeYf7NlhIu6dWnp Zy9SGP7Wqykf5YrM0SSkeiXF3n4= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:reply-to:subject:references:to:from:message-id :date:mime-version:in-reply-to:content-type :content-transfer-encoding; s=default; bh=MQ5MigWsmuQcAf/35vH+D5 3jpT8=; b=KziMF3oRFQA2iTVuOH9WohKAC0vYcV3Eh0tn+IaHydaDLLNHzvJwq2 4Pl3KC417QPBWicxT0PCCYK1ftMNLTK3vXYcWTIlQo8ZAcYywr3t9+ZAJrGZTE6M zAunZBvrVAJ5gl3tzJp6JFQtKwtMCYj6fB6zxd7WctxXk3I/XyZ3w= Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT com Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=0.4 required=5.0 tests=AWL,BAYES_50,KAM_LAZY_DOMAIN_SECURITY,RP_MATCHES_RCVD,UNSUBSCRIBE_BODY autolearn=ham version=3.3.2 spammy=hooked, knowledgeable, Balaic, balaic X-HELO: mailsrv.cs.umass.edu Reply-To: moss AT cs DOT umass DOT edu Subject: Re: Pipe behavior clarification? References: To: cygwin AT cygwin DOT com From: Eliot Moss Message-ID: <2e4799d9-e81f-fabb-9f31-3c569a70efc9@cs.umass.edu> Date: Sun, 22 Jan 2017 17:23:47 -0500 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.6.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit X-IsSubscribed: yes On 1/22/2017 3:19 PM, David Balažic wrote: > Hi! > > Is this a correct pipe behavior? > > $ echo booo | tee >(md5sum --tag) >/dev/null > MD5 (-) = 9c8b79bdf79ef0ee73a77b8d36d27a2d > > $ echo booo | tee >(md5sum --tag) | cat >/dev/null Here's what I think happens, even if it is a bit counter-intuitive: >(...) creates a subprocess, whose input comes from some kind of pipe or socket, and tee is presented with a filename it can use to write to that socket. The *output* of the >(...) subprocess is hooked up to what is known to be the output of tee *at the time the subprocess is created*. This happens *before* any > redirections are done. However, in the case of the | pipe, that plumbing is set up *before* the >(...) construct is acted on. Note that you could do >(md5sum --tag >whatever) if you want to specifically control the output of md5sum. I am sure someone more knowledgeable will correct me if I've missed anything important here :-) ... Regards - Eliot Moss -- Problem reports: http://cygwin.com/problems.html FAQ: http://cygwin.com/faq/ Documentation: http://cygwin.com/docs.html Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple