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,NICE_REPLY_A,RCVD_IN_DNSWL_MED,UNPARSEABLE_RELAY autolearn=ham autolearn_force=no version=3.4.4 Received: (qmail 20971 invoked from network); 28 Jan 2021 04:58:22 -0000 Received: from zero.zsh.org (2a02:898:31:0:48:4558:7a:7368) by inbox.vuxu.org with ESMTPUTF8; 28 Jan 2021 04:58:22 -0000 ARC-Seal: i=1; cv=none; a=rsa-sha256; d=zsh.org; s=rsa-20200801; t=1611809902; b=c4LepafV80zI2JO9rirXVN5EEJzP7TFrs9Eev+pK01yO1hqIxKD4O679zMrwFUSlTXj+sOUjm4 zDjN6hjtTQpBHYjZRmJoasQUExOCiaQp4MTuBKRDEx4AcWvv3XMYhUkcBpTnJCsCSFS7STop4k jTA7R3vxvjwTQHxitFhyOBvKdRqX0iGd0lEubpzPNiL50IqosUCzkjef71nQvYCRoN2Ola1Dj7 4BNngcRI5q+NmHvdFvVfNNdhffuK8pQ3F+1t+P57m9s42F15nmylbmvgH2eFUBhhcC1wPoMtB7 /sumixWRRA0UUEUBSRzK7vVTzswGRmzcnctXR8lcmPVf9g==; ARC-Authentication-Results: i=1; zsh.org; iprev=pass (mta01.eastlink.ca) smtp.remote-ip=24.224.136.30; dmarc=none header.from=eastlink.ca; arc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed; d=zsh.org; s=rsa-20200801; t=1611809902; bh=5scGlQ6lqu5nI9D7d/IuS0f+yGY52BRf6qccgjrM3lU=; h=List-Archive:List-Owner:List-Post:List-Unsubscribe:List-Subscribe:List-Help: List-Id:Sender:Content-Transfer-Encoding:Content-Type:In-Reply-To: MIME-Version:Date:Message-ID:From:References:To:Subject:DKIM-Signature; b=U093vvIFMyZphdFgLl/DoT97vAxszBl/4ds+FdKekCaVOWkeD/B2gZ7tUSkdCXFDdr4PzDwtVB pdJv1QOuyJ/qFlzFiRzaIsUsm8Qa9De7lYIlyZFx1WOeC8MlFXrEtfFWBExuomaqA4/hY0Upmq CDvfbSo0S/s+q60bdOZVaLHoWqk8rO0v1BJVJLT8cTLkZi+SGgn4yeOSA4qGpczQ9m2CfyHn/a C0CzYUDFVjivP4dNI1QLWKf8LYsoNKvT46+5GNrWII1mqTIYv7rzXgq6QiDbWB2q6/oOl1q7m4 bh8SwHx4r1+H/vMwx34fG8frplcKAv0CDKkREx6pUBE6Ng==; 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:Content-transfer-encoding: Content-type:In-reply-to:MIME-version:Date:Message-id:From:References:To: Subject:Reply-To:Cc:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID; bh=ogrpG2sGDFQqg+wHofAg00+XGRQbAC9sDyWx5v3TKJM=; b=zM0fF+3WLk7nNn6PyfAIdV0pCK 8f4UymEGAURM2IgTvOSzC6GLxNNNhke0cM4nN0y8vs+MpGdkpdC1i0bEFuwIwD9+cpLpFzM0BT3IX rGM5YYz6I0xnxw15SqAVRPuZO9D1cfeu/LRgNB+2bsmHOJ460++zxM3JzuewzGv0++jlGCoX50Kbx 3IVE7R101SfSzr62fagFozIJLyetkM3zflBq8iytPQyv6UfNwd7aZ+AnKKDNI0k/zaeIsxf7m/LDD TIy8mV+jCV9Dhe5sByn7fujfRu3y+lcXSpQcnqwxEZkcN2+Yl+UMVJUK2gb/NVVN6EFuzHO9GV7yt 8OvikImQ==; Received: from authenticated user by zero.zsh.org with local id 1l4zNr-000L9f-Fx; Thu, 28 Jan 2021 04:58:19 +0000 Authentication-Results: zsh.org; iprev=pass (mta01.eastlink.ca) smtp.remote-ip=24.224.136.30; dmarc=none header.from=eastlink.ca; arc=none Received: from mta01.eastlink.ca ([24.224.136.30]:46754) by zero.zsh.org with esmtps (TLS1.2:ECDHE-RSA-AES128-GCM-SHA256:128) id 1l4zNC-000KlA-PQ; Thu, 28 Jan 2021 04:57:39 +0000 Received: from csp01.eastlink.ca ([71.7.199.166]) by mta01.eastlink.ca (Oracle Communications Messaging Server 8.0.2.2.20180531 64bit (built May 31 2018)) with ESMTPS id <0QNM00INWNZT7580@mta01.eastlink.ca> for zsh-users@zsh.org; Thu, 28 Jan 2021 00:57:36 -0400 (AST) Received: from [192.168.0.2] ([24.207.90.194]) by Eastlink with ESMTP id 4zNAlwgtfsAqK4zNAlS4vy; Thu, 28 Jan 2021 00:57:36 -0400 X-Authority-Analysis: v=2.4 cv=W6f96Tak c=1 sm=1 tr=0 ts=60124440 a=zv49KfEsxEDzuN5AGO7r0Q==:117 a=zv49KfEsxEDzuN5AGO7r0Q==:17 a=IkcTkHD0fZMA:10 a=LRA8bRQ0nxYvwLmms3MA:9 a=QEXdDO2ut3YA:10 X-Vade-Cause: gggruggvucftvghtrhhoucdtuddrgeduledrvdelgdejhecutefuodetggdotefrodftvfcurfhrohhfihhlvgemucfgtefuvffnkffpmfdpqfgfvfenuceurghilhhouhhtmecufedttdenucenucfjughrpefuvfhfhffkffgfgggjtgfgsehtkeertddtfeejnecuhfhrohhmpeftrgihucetnhgurhgvfihsuceorhgrhigrnhgurhgvfihssegvrghsthhlihhnkhdrtggrqeenucggtffrrghtthgvrhhnpeekvdeuuefffefhvdeuieetffdvtddvjeegueejkeeiudehieetieehgeetvdfhfeenucfkphepvdegrddvtdejrdeltddrudelgeenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepihhnvghtpedvgedrvddtjedrledtrdduleegpdhhvghloheplgduledvrdduieekrddtrddvngdpmhgrihhlfhhrohhmpehrrgihrghnughrvgifshesvggrshhtlhhinhhkrdgtrgdprhgtphhtthhopeiishhhqdhushgvrhhsseiishhhrdhorhhgpdhgvghtqdgkihhprfgrshhsfigupehtrhhuvg X-Vade-Score: 0 X-Vade-State: 0 X-EL-IP-NOAUTH: 24.207.90.194 Subject: Re: detect pipe To: zsh-users@zsh.org References: From: Ray Andrews Message-id: <1b788ada-9c70-78e5-cc2c-1943000f2994@eastlink.ca> Date: Wed, 27 Jan 2021 20:57:36 -0800 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.6.0 MIME-version: 1.0 In-reply-to: Content-type: text/plain; charset=utf-8; format=flowed Content-transfer-encoding: 8bit Content-language: en-US X-Seq: 26423 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-27 3:59 p.m., Bart Schaefer wrote: > [[ -p /dev/fd/0 ]] Nuts, using that it turns out that the issue is that my functions tend to be called via aliases:     alias test2='noglob test1' test1 () {     if [[ -p /dev/fd/0 ]]; then         echo "PIPES ARE AS BAD AS CIGARETTES"         grep --color=always "$1"     else         echo "NO, THEY AREN'T"         grep --color=always "$1" "$2"     fi } Testing it: $ . test; echo "Now is the time for all good men" | test1 'the time' PIPES ARE AS BAD AS CIGARETTES Now is the time for all good men $ . test; echo "Now is the time for all good men" | test2 'the time' NO, THEY AREN'T grep: : No such file or directory $ . test; test1 'the time' junk    # junk contains the same string NO, THEY AREN'T Now is the time for all good men $ . test; test2 'the time' junk NO, THEY AREN'T Now is the time for all good men ... so the pipe test is fooled by the alias. Strange tho that it used to work and still does *sometimes*.  Very flaky. Dunno why an alias would ... well that's just it, I don't know.