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 26061 invoked from network); 6 Dec 2022 06:40:04 -0000 Received: from zero.zsh.org (2a02:898:31:0:48:4558:7a:7368) by inbox.vuxu.org with ESMTPUTF8; 6 Dec 2022 06:40:04 -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=3eGv4P2mYeickHUGXDvEFbW5891WscArQM0eXbTwGrw=; b=sJY2BilChas8/MRWsp52bkYgvM E8WbhWOPDREOzlsDbchK49+E5PQzEhtgVEFzamklbqCQ8nFO990obPcrE2KjJ9fCw9Gth0imz3S02 DBXn6jmPUwP5hX80BjxH1nej3Nn9hQ3+vsSp6s3URtr7OY7lMsTtyY2cd7xftotgVMvg6AuiSt70z Y7Gs0Gab/y5ZU89MQuAkhvQloThtqEftGl0twZ8oV8Rm4PAgaEJ5gWbIPEE6CyZIEdhXHkbCY2ZKn 8XGyOeXTyMWUjfeJ1f59NrqU3xqfqCNsjzvkMvRbTHF4fUVQx+SZB8mNhBzHnfe2waDAoYuDQ0pkE +BN5LcBw==; Received: by zero.zsh.org with local id 1p2Rca-0006RS-7r; Tue, 06 Dec 2022 06:40:04 +0000 Received: by zero.zsh.org with esmtpsa (TLS1.3:TLS_AES_256_GCM_SHA384:256) id 1p2Rbu-0005lR-Lz; Tue, 06 Dec 2022 06:39:22 +0000 Received: from compute1.internal (compute1.nyi.internal [10.202.2.41]) by mailauth.nyi.internal (Postfix) with ESMTP id 99D8727C0054; Tue, 6 Dec 2022 01:39:21 -0500 (EST) Received: from imap48 ([10.202.2.98]) by compute1.internal (MEProxy); Tue, 06 Dec 2022 01:39:21 -0500 X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvhedrudehgdelkecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpefofgggkfgjfhffhffvvefutgfgsehtqhertderreejnecuhfhrohhmpefnrgif rhgvnhgtvgcugggvlhojiihquhgviicuoehlrghrrhihvhesiihshhdrohhrgheqnecugg ftrfgrthhtvghrnhepheegieduieegvddvffdvgeefuddugfetvdettddtfedutdejvefg jefgveethedunecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrh homheplhgrrhhrhihvodhmvghsmhhtphgruhhthhhpvghrshhonhgrlhhithihqdduudeh udekjeejtdegqdduudelvdejfeekhedqlhgrrhhrhihvpeepiihshhdrohhrghesfhgrsh htmhgrihhlrdgtohhm X-ME-Proxy: Feedback-ID: iaa214773:Fastmail Received: by mailuser.nyi.internal (Postfix, from userid 501) id 684E231A0063; Tue, 6 Dec 2022 01:39:21 -0500 (EST) X-Mailer: MessagingEngine.com Webmail Interface User-Agent: Cyrus-JMAP/3.7.0-alpha0-1115-g8b801eadce-fm-20221102.001-g8b801ead Mime-Version: 1.0 Message-Id: <19107309-e5a4-4e41-8bfc-48cb46fb727d@app.fastmail.com> In-Reply-To: <54bcd6dd-e589-4696-f042-1155b78df9d2@eastlink.ca> References: <54bcd6dd-e589-4696-f042-1155b78df9d2@eastlink.ca> Date: Tue, 06 Dec 2022 01:39:01 -0500 From: =?UTF-8?Q?Lawrence_Vel=C3=A1zquez?= To: "Ray Andrews" Cc: zsh-users@zsh.org Subject: Re: The elements of enlightenment Content-Type: text/plain;charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Seq: 28503 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 Mon, Dec 5, 2022, at 10:57 AM, Ray Andrews wrote: > By double quoting: ( "$( setopt )" ) we seem to have=20 > solved the problem, it prints correctly.=C2=A0 But trouble lurks in th= e=20 > shadows. =C2=A0 I do this: > > =C2=A0=C2=A0=C2=A0 $=C2=A0 list=3D( "${list[@]/ off/${red} off${nrm}}= " ) > > ... And I'm baffled that only the very first 'off' is colorized. Why?=C2= =A0=20 > Because '$#list' =3D 1!=C2=A0 It looks like we have each line as a sep= arate=20 > element but we don't.=C2=A0 It only looks that way because the newline= s in=20 > the output are still in there, they aren't 'print -l' newlines, they'r= e=20 > newlines in the data itself!! They look the same but they are *not* th= e=20 > same. As an aside, simply printing out data structures' contents is an unreliable debugging tool, for reasons you have just discovered. % arr=3D($'a\nb\rc' $'d\re\nf') % print -l $arr a c e f A better tool is "typeset -p", which outputs an accurate (albeit sometimes difficult-to-read) representation. % typeset -p arr typeset -a arr=3D( $'a\nb\C-Mc' $'d\C-Me\nf' ) --=20 vq