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.4 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham autolearn_force=no version=3.4.4 Received: (qmail 7755 invoked from network); 14 Oct 2022 06:36:54 -0000 Received: from zero.zsh.org (2a02:898:31:0:48:4558:7a:7368) by inbox.vuxu.org with ESMTPUTF8; 14 Oct 2022 06:36:54 -0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=zsh.org; s=rsa-20210803; h=List-Archive:List-Owner:List-Post:List-Unsubscribe: List-Subscribe:List-Help:List-Id:Sender:Content-Transfer-Encoding: Content-Type:Subject:Cc:To:From:Date:References:In-Reply-To:Message-Id: Mime-Version:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID; bh=FQTNRynzpPgfbHdzOZxsA5Jfd6G2DMsmJQrXPQmtXqo=; b=rJKDvdQwIhjBgFIeKe6rIjyhnX 4Rh/e1W/w6T5jUu/1GnlhfYgUd1iYX9VTUF/m7dg7BBwN8ekJJZ2wuiZ+R3jekll5Jil1c581nB3Q 7Aif3nD14THG5Esoz7nSRNlwjdARGKnJYzO8Jrxe2I++tksOgJ+GIhfZLLwOGyE1WNzMrHb2MQw5i nJY3SWWGVhBq1MEfaNRea8U+V+8hmt9ESbvspzWUJCRPOMgW5zpSw1PpMDMdxsidZ/9qg+hLuOZe+ WtO5syBUbFEv9ecci+XyLly1DNByORiQLGw7Wbu7s/bernQXqzYNulfPkJZwEzwqu8XAWjXWqBG2z 0v8xAZsQ==; Received: by zero.zsh.org with local id 1ojEJQ-0003ct-TG; Fri, 14 Oct 2022 06:36:52 +0000 Received: by zero.zsh.org with esmtpsa (TLS1.3:TLS_AES_256_GCM_SHA384:256) id 1ojEIg-0002wg-0v; Fri, 14 Oct 2022 06:36:06 +0000 Received: from compute2.internal (compute2.nyi.internal [10.202.2.46]) by mailauth.nyi.internal (Postfix) with ESMTP id A908627C0054; Fri, 14 Oct 2022 02:36:03 -0400 (EDT) Received: from imap48 ([10.202.2.98]) by compute2.internal (MEProxy); Fri, 14 Oct 2022 02:36:03 -0400 X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvfedrfeekuddgudduudcutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfgh necuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmd enucfjughrpefofgggkfgjfhffhffvvefutgfgsehtqhertderreejnecuhfhrohhmpefn rgifrhgvnhgtvggpgggvlhojiihquhgviicuoehlrghrrhihvhesiihshhdrohhrgheqne cuggftrfgrthhtvghrnhepffehvdelvdeihffhvdejffeitdeuvdetjefhuedufeetgeet geegjedtgfeffedunecuffhomhgrihhnpehsohhurhgtvghfohhrghgvrdhiohenucevlh hushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpehlrghrrhihvhdo mhgvshhmthhprghuthhhphgvrhhsohhnrghlihhthidqudduhedukeejjedtgedquddule dvjeefkeehqdhlrghrrhihvheppeiishhhrdhorhhgsehfrghsthhmrghilhdrtghomh X-ME-Proxy: Feedback-ID: iaa214773:Fastmail Received: by mailuser.nyi.internal (Postfix, from userid 501) id 7700531A03F7; Fri, 14 Oct 2022 02:36:03 -0400 (EDT) X-Mailer: MessagingEngine.com Webmail Interface User-Agent: Cyrus-JMAP/3.7.0-alpha0-1047-g9e4af4ada4-fm-20221005.001-g9e4af4ad Mime-Version: 1.0 Message-Id: In-Reply-To: <9184bbff-9e68-7b02-2595-3474b016dfff@eastlink.ca> References: <9184bbff-9e68-7b02-2595-3474b016dfff@eastlink.ca> Date: Fri, 14 Oct 2022 02:35:43 -0400 From: =?UTF-8?Q?Lawrence_Vel=C3=A1zquez?= To: "Ray Andrews" Cc: zsh-users@zsh.org Subject: Re: line continuation with sed Content-Type: text/plain;charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Seq: 28202 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: On Thu, Oct 13, 2022, at 2:25 PM, Ray Andrews wrote: > I'm wondering if this is a zsh issue or entirely sed's fault but: > > $ var=3D$( print -l $var | sed \ > -re 's/.../' \ =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2= =A0 =C2=A0=C2=A0=C2=A0 # this is fine > -re 's/.../'\=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 = =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2= =A0 =C2=A0=C2=A0=C2=A0 =C2=A0 # this=C2=A0 throws an error=20 > which I'd expect > -re 's/.../' \=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2= =A0 =C2=A0=C2=A0=C2=A0 =C2=A0 # this throws an error ... > -re 's/.../' ) As an aside, you only need to specify -r (or -E) once. Repeating it has no effect. > ... if there is a bloody space AFTER the backslash and before the=20 > newline.=C2=A0 Thing is it's an invisible error, I just wasted the mor= ning=20 > with some sed errors which refused to be found because they were=20 > invisible.=C2=A0 What logic would make a space before the newline an e= rror?=C2=A0=20 > I'm thinking it must be a zsh issue because zsh is responsible for lin= e=20 > continuation. It is not an "issue", but zsh is indeed responsible. > Multiple spaces between sed expressions are fine as one=20 > would expect so if the backslash simply wrapped the line, there should=20 > be no issue.=C2=A0 Mind, haven't I whined about this before?=C2=A0 Cou= ld there=20 > ever be a situation where backslash-space-newline was not logically=20 > reducible to backslash-newline? What makes you think they are equivalent? They are not. https://zsh.sourceforge.io/Doc/Release/Shell-Grammar.html#Quoting A character may be quoted (that is, made to stand for itself) by preceding it with a '\'. '\' followed by a newline is ignored. So the sequence \ SP LF is a quoted space followed by an unquoted line feed. In this example (and your original), the latter acts in its common capacity as a sublist terminator: % eval $'printf "<%s>\n" foo \\\nbar' % eval $'printf "<%s>\n" foo \\ \nbar' < > zsh: command not found: bar --=20 vq