From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=-0.8 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE autolearn=ham autolearn_force=no version=3.4.2 Received: from minnie.tuhs.org (minnie.tuhs.org [45.79.103.53]) by inbox.vuxu.org (OpenSMTPD) with ESMTP id 9bfd8f3c for ; Fri, 3 Jan 2020 17:11:47 +0000 (UTC) Received: by minnie.tuhs.org (Postfix, from userid 112) id 9D8AE9B4F1; Sat, 4 Jan 2020 03:11:46 +1000 (AEST) Received: from minnie.tuhs.org (localhost [127.0.0.1]) by minnie.tuhs.org (Postfix) with ESMTP id 441E29516C; Sat, 4 Jan 2020 03:11:15 +1000 (AEST) Authentication-Results: minnie.tuhs.org; dkim=fail reason="key not found in DNS" (0-bit key; unprotected) header.d=zick.io header.i=@zick.io header.b="QR3p+kxb"; dkim=pass (2048-bit key; unprotected) header.d=messagingengine.com header.i=@messagingengine.com header.b="kMSs/cH/"; dkim-atps=neutral Received: by minnie.tuhs.org (Postfix, from userid 112) id C0CFB9516C; Sat, 4 Jan 2020 03:11:11 +1000 (AEST) X-Greylist: delayed 462 seconds by postgrey-1.36 at minnie.tuhs.org; Sat, 04 Jan 2020 03:11:10 AEST Received: from out5-smtp.messagingengine.com (out5-smtp.messagingengine.com [66.111.4.29]) by minnie.tuhs.org (Postfix) with ESMTPS id BA91C9516B for ; Sat, 4 Jan 2020 03:11:10 +1000 (AEST) Received: from compute6.internal (compute6.nyi.internal [10.202.2.46]) by mailout.nyi.internal (Postfix) with ESMTP id 21F2621F83 for ; Fri, 3 Jan 2020 12:03:28 -0500 (EST) Received: from imap24 ([10.202.2.74]) by compute6.internal (MEProxy); Fri, 03 Jan 2020 12:03:28 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=zick.io; h= mime-version:message-id:in-reply-to:references:date:from:to :subject:content-type:content-transfer-encoding; s=fm1; bh=K3hKr 4nGowDyE2gvX0L31IxGeSa0WgXeqO5mbOwXBt8=; b=QR3p+kxb0Xm01syfNBLVK sMTpJZSO4g/++pbb9Rxx+QcEn5C5hyupID5rYI5umXn50+j+Ch246f0sw5Wa3+NU IyhnSc6xPqWahwitBB2SUrbwHzk7B9ASuS8ClB8zjfvTHyu2Cp6ONCA9lUA1svnu zzoG38Aa74yHnQhSBpyTPUsf8cZivQXHHv3/mdPbhU+4ppjYoAxul80s1hQmkGUt q50/F2Jao6rGUBub4vYzxRO5qrYtJIGCZa8DlUcTxkNEmduNh7BEwy8o2c0ODtij pYo5CnBJ0LO+eYoXYIrrEHvLcC4CRw9lcRkrlPlZ2nOPHJUdO18DLVdol6hMB3XK w== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:references :subject:to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender :x-sasl-enc; s=fm1; bh=K3hKr4nGowDyE2gvX0L31IxGeSa0WgXeqO5mbOwXB t8=; b=kMSs/cH/+J16u1RnrE0fB3hUrn4s5dQxykvOWyq+rKhLs4j0nvU7xtbWO KxJlh63Q95weGhdsOR4YM56cMZRLVqidhsKi7xhaBqYoSlis+1IbM1WNZ8Y3yYc1 pQ8otMWLz4XHGaRU5pd3/hPgj2AeNH13Rq996q9XkgJWGZpfH7Ex+5Wdu9d6NKfJ ScMktvcT1u3ZgB1lBpdrqqU3VZAlHUmY9CcV/izewPND1KMml0HsHnvuGMC6/cZj VmK0MHWUXT2Qj4wsRARD3Lbj51fX6FPmIg2ylJPealkzQctdWv0m4gFvwy2VJb+B 4Hm7L/xe8QVKlLqAkK8NAg0+mCMOw== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedufedrvdegfedgleeiucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhepofgfggfkjghffffhvffutgfgsehtqhertderreejnecuhfhrohhmpedfuehr ihgrnhcukghitghkfdcuoegsrhhirghnseiiihgtkhdrihhoqeenucfrrghrrghmpehmrg hilhhfrhhomhepsghrihgrnhesiihitghkrdhiohenucevlhhushhtvghrufhiiigvpedt X-ME-Proxy: Received: by mailuser.nyi.internal (Postfix, from userid 501) id E6FAA2000A3; Fri, 3 Jan 2020 12:03:27 -0500 (EST) X-Mailer: MessagingEngine.com Webmail Interface User-Agent: Cyrus-JMAP/3.1.7-694-gd5bab98-fmstable-20191218v1 Mime-Version: 1.0 Message-Id: <01d9e48c-2f92-48b9-b4ec-cd29fcfd1fa4@www.fastmail.com> In-Reply-To: <20200103140055.XB8iT%steffen@sdaoden.eu> References: <1inMKv-0Km-00@marmaro.de> <20200103140055.XB8iT%steffen@sdaoden.eu> Date: Fri, 03 Jan 2020 11:03:07 -0600 From: "Brian Zick" To: "Grant Taylor via TUHS" Content-Type: text/plain;charset=utf-8 Content-Transfer-Encoding: quoted-printable Subject: Re: [TUHS] sh: cmd | >file X-BeenThere: tuhs@minnie.tuhs.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: The Unix Heritage Society mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: tuhs-bounces@minnie.tuhs.org Sender: "TUHS" I'm curious to know if you have a script you used to prove these correct= ? B On Fri, Jan 3, 2020, at 8:00 AM, Steffen Nurpmeso wrote: > markus schnalke wrote in <1inMKv-0Km-00@marmaro.de>: > |Hoi, >=20 > Morsche. >=20 > |in a computer forum I came across a very long command line, > |including `xargs' and `sh -c'. Anyways, throughout the thread > |it was modified several times, when accidently a pipe symbol > |appeared between the command and the output redirection. The > |command line did nothing; it ran successful. I was confused, > |because I expected to see a syntax error in case of > |``cmd|>file''. This made me wonder ... > | > | > |With help of Sven Mascheck, I was able to clear my understanding. > |The POSIX shell grammer provided the answer: > ... > |A redirection is a (full) simple_command ... and because > |``simple_command | simple_command'' is allowed, so is > |``io_file | io_file''. This can lead to such strange (but > |valid) command lines like: > |=20 > | b=20 > |>b | |=20 > |Sven liked this one: > | > |:|>:=20 > | > |Here some further fun variants: > |=20 > |:|:>:=20 > | > | <:|:>:=20 > | > |They would provide nice puzzles. ;-) > ... > |- Syntax ok in these shells: > | > |SVR2 sh (Ultrix), SVR4 sh (Heirloom) >=20 > Be aware of spurious :> errors in Heirloom shell, and maybe its > origin (never had those). It is why the unit test of my little > web site builder thing has been switched to "printf '' > FILE". >=20 > |ksh93 > |bash-1.05, bash-aktuell > |pdksh-5.2.14 > |ash-0.4.26, dash-0.5.6.1 > |posh-0.3.7, posh-0.12.3 > |mksh-R24, mksh-R52b > |yash-2.29 > |zsh-3.0.8, zsh-4.3.17 > | > |- Exception to the rule: > | > |7thEd sh: > | > |=C2=A0=C2=A0=C2=A0 # pwd|>>file > |=C2=A0=C2=A0=C2=A0 # echo $? > |=C2=A0=C2=A0=C2=A0 141 > | > |On first sight ok, but with a silent error ... SIGPIPE (128+13). > | > |I'd be interested in any stories and information around this > |topic. > | > |What about 7thEd sh? >=20 > Beware of bugs in the above code; I have only proved it correct, > not tried it. >=20 > |meillo > --End of <1inMKv-0Km-00@marmaro.de> >=20 > --steffen > | > |Der Kragenbaer, The moon bear, > |der holt sich munter he cheerfully and one by one > |einen nach dem anderen runter wa.ks himself off > |(By Robert Gernhardt) >