From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=-3.3 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED,UNPARSEABLE_RELAY autolearn=ham autolearn_force=no version=3.4.4 Received: (qmail 20664 invoked from network); 14 Feb 2021 17:32:16 -0000 Received: from zero.zsh.org (2a02:898:31:0:48:4558:7a:7368) by inbox.vuxu.org with ESMTPUTF8; 14 Feb 2021 17:32:16 -0000 ARC-Seal: i=1; cv=none; a=rsa-sha256; d=zsh.org; s=rsa-20200801; t=1613323936; b=UFLj1Fl4vNJewNqK3kqpN9IpJa/xBzXGfgTmulLTYs9qX5z6ql+pTLE2/fCNFFsjJj0OjZERx6 c3zDuYP6Z0zJ5aHRXY7z8L6wPfQ3ldyqQkhTpyUOITtaeY+R4Q4sSOx7OtSgvbH102U3Yq0uUS obMcgk0NEBxo/RFua9jQYyraEHaG2JiZm99EQspxkM48grdJkrYh/H4aGy/eAbP9VHLeY847UZ K2POKLX3/uNaGVb/gxW302k7uNIfUGjidf8HhCxoIWVFZdwRS9TzNtcac6vWnN60uKZTdzQB0H HHS4+yhw6ch5A2+ChcVxbQURgIanxrYAg3mlZnnKGSldPg==; ARC-Authentication-Results: i=1; zsh.org; iprev=pass (joooj.vinc17.net) smtp.remote-ip=155.133.131.76; dmarc=none header.from=vinc17.net; arc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed; d=zsh.org; s=rsa-20200801; t=1613323936; bh=DLT8h12o9w5g48K3JLUWhcnsLXsjNdAUAMTOB7E3Y4c=; h=List-Archive:List-Owner:List-Post:List-Unsubscribe:List-Subscribe:List-Help: List-Id:Sender:In-Reply-To:Content-Transfer-Encoding:Content-Type: MIME-Version:References:Message-ID:Subject:To:From:Date:DKIM-Signature; b=iCdnGA+8eJSHQgjFoC4QnbhMjk1bjFCD55cdsmt2Po5uUfmajgJXYsIe6jGrL7C2iplIQpL4gr EpKGoYcFRfRD8ldIb1Mqu1GSS891JImBStB4ID6mAApZLWNnmCYG2untkxTADb2PHmA1AT84sK j1eGLlwmLV9ifgplDbWyQL3Smwv35ytVSI+RAltlWJX8w9/LCTaYG0l3/9kaehKhKBclALxBom QlQN60vAlTZo1qRRuGJQL5ce5avS/+9Il2KO/JL2ZGkAI8XWmTTNezlVjWaHT8+CWb7YDAq28D PN+iVEq13VWteXxYkhIGlN3C7JIO4Lg71gDjkJJ9XWaV0g==; DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=zsh.org; s=rsa-20200801; h=List-Archive:List-Owner:List-Post:List-Unsubscribe: List-Subscribe:List-Help:List-Id:Sender:In-Reply-To:Content-Transfer-Encoding :Content-Type:MIME-Version:References:Message-ID:Subject:To:From:Date: Reply-To:Cc:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID; bh=+kI7jF5Lwz0QiQuYIvQYB7oEOevBpByqtCPoH0RtLJM=; b=JNr/3ikaI+iKZMiPZ5Im6gkTiI W3v5blcKGTO6rt4LhgxDgPIUHyF4Tj5fmjDo4PSy3GsKT2bsEQE0rFfApnUqpTNwmDUf+etikucmI 5mDbliaN+xpYrDnivbsBnkbUSI8Un5OpkYsAoyiFEUK8i3BiUC+poc1DUsSrk5mej8C4B66gwBfEm 2b2DVAEsDVbaJEVhDXmbJwomq/EDOxjr+z2Fac6CU3K1d5lzMWDpfHGmEUKrLIC1UelcxExkmNLVh /2aPzVirZk6nZ75xX13VtmIPMepWmutG7spY9+VsVGCxSko6aJMjhmBC51YhimGy6/d2hVAfkL9CT WFrFsKdw==; Received: from authenticated user by zero.zsh.org with local id 1lBLFl-000OMH-Ql; Sun, 14 Feb 2021 17:32:13 +0000 Authentication-Results: zsh.org; iprev=pass (joooj.vinc17.net) smtp.remote-ip=155.133.131.76; dmarc=none header.from=vinc17.net; arc=none Received: from joooj.vinc17.net ([155.133.131.76]:39802) by zero.zsh.org with esmtps (TLS1.3:TLS_AES_256_GCM_SHA384:256) id 1lBLFE-000NyB-2o; Sun, 14 Feb 2021 17:31:42 +0000 Received: from smtp-zira.vinc17.net (128.119.75.86.rev.sfr.net [86.75.119.128]) by joooj.vinc17.net (Postfix) with ESMTPSA id 1EB3C2FF; Sun, 14 Feb 2021 18:31:38 +0100 (CET) Received: by zira.vinc17.org (Postfix, from userid 1000) id 62D9FC202CA; Sun, 14 Feb 2021 18:31:38 +0100 (CET) Date: Sun, 14 Feb 2021 18:31:38 +0100 From: Vincent Lefevre To: zsh-users@zsh.org Subject: Re: detect pipe Message-ID: <20210214173138.GA2298446@zira.vinc17.org> Mail-Followup-To: zsh-users@zsh.org References: <20210128102816.GB578422@zira.vinc17.org> <560cef52-aee7-352a-2ba3-25826fe54136@eastlink.ca> <14ce37b2-35ca-6002-474a-7de5d6626a66@eastlink.ca> <05c3d2ba-6a00-9480-e2a8-685432e2442c@eastlink.ca> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: X-Mailer-Info: https://www.vinc17.net/mutt/ User-Agent: Mutt/2.0.5+111 (106ff19a) vl-132933 (2021-02-08) X-Seq: 26512 Archived-At: X-Loop: zsh-users@zsh.org Errors-To: zsh-users-owner@zsh.org Precedence: list Precedence: bulk Sender: zsh-users-request@zsh.org X-no-archive: yes List-Id: List-Help: List-Subscribe: List-Unsubscribe: List-Post: List-Owner: List-Archive: Archived-At: On 2021-01-30 11:00:15 -0800, Bart Schaefer wrote: > On Sat, Jan 30, 2021 at 6:27 AM Ray Andrews wrote: > > > > Cool stuff Bart. Would you please elaborate on 'Close stdin'? > > ubuntu% ls /dev/fd/0 > /dev/fd/0 > ubuntu% ls /dev/fd/0 <&- > ls: cannot access '/dev/fd/0': No such file or directory > > File descriptor zero, the standard input, has been closed; it > literally does not exist for "ls" (in this example). If it's closed, > it's not possible to read from it: > > ubuntu% cat <&- > cat: -: Bad file descriptor > cat: closing standard input: Bad file descriptor > > Most commands will ignore a closed stdin and behave similarly to > reading from /dev/null. Closing stdin is a bad idea, as this can break stdout redirection, and this may be out of control of the commands. See https://sourceware.org/bugzilla/show_bug.cgi?id=682 -- Vincent Lefèvre - Web: 100% accessible validated (X)HTML - Blog: Work: CR INRIA - computer arithmetic / AriC project (LIP, ENS-Lyon)