From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=-3.1 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_EF,HEADER_FROM_DIFFERENT_DOMAINS,HTML_MESSAGE, HTML_OBFUSCATE_05_10,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham autolearn_force=no version=3.4.4 Received: from zero.zsh.org (zero.zsh.org [IPv6:2a02:898:31:0:48:4558:7a:7368]) by inbox.vuxu.org (Postfix) with ESMTP id 7297923C09 for ; Sun, 14 Apr 2024 18:24:02 +0200 (CEST) ARC-Seal: i=1; cv=none; a=rsa-sha256; d=zsh.org; s=rsa-20210803; t=1713111842; b=rV0wRjdfLvgNImLkLmKcRlCzRYuuCbY28n+EZQMwq+b2MJLB4QlgXoqGJVjrdmZFMoQ4un8nhb naTxW/U2jmgB3bYOif56kB5VwTyBcWB8rEluQgy6uagOjG5kOnnqvvGHafpOOTn0zq3gl8Bu7g XefIaEJSBbqT358eIWOB35irpl76ePyq+kSw8WOylkSdhwWnZ72vNLC8upPJUHTd8q+JKD6ytn CNtKU1cm7LEWIxePCopxR7DAXBVyktd0JugAlX8BLZe9vduPGSBoNH3dWsLHVcrnaekj/vR3Fs 0uPZXRZONZ/7RpzjMdPaRbrAeGp5iZ0hKpSnwFImKsqLZg==; ARC-Authentication-Results: i=1; zsh.org; iprev=pass (mta03.eastlink.ca) smtp.remote-ip=24.224.136.9; dmarc=none header.from=eastlink.ca; arc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed; d=zsh.org; s=rsa-20210803; t=1713111842; bh=Voguzpp1crtdK92PJ4DsrR2Zv3muKESCEM2v0Q+2meg=; h=List-Archive:List-Owner:List-Post:List-Unsubscribe:List-Subscribe:List-Help: List-Id:Sender:In-Reply-To:From:References:To:Subject:MIME-Version:Date: Message-ID:Content-Type:DKIM-Signature; b=i3JqToeaKyIamapgCG1IdI5OxYGRohDD1kQkgI+Dw3GuVL+q/znt9mwW8AdVOVCVM2xzuBv5xB JiA0IklQpWxjJnvMRify8ExC56qP4WM8sjMyjTNbAnadaGBmMJHzClALu/oWKmoLFU88wmIona ZSUnsKBiwIr45ZcXWicbbsZXXM1/GHyQU/velt2d8Qj4CzrLWX/0s18hwO7TXADMiHNZ5/APnS z4r1ZryvzhafBNdZHQOj2FZFU3RKJothPSbLF4iQTKhU1RHL15nDnxH872ipNFGSS88azEDHYZ Z0V59D+7mWCvO2zSY4IClAuopNIYJ112UoS+a73H4CeDpg==; 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:In-reply-to:From:References:To: Subject:MIME-version:Date:Message-id:Content-type:Reply-To:Cc: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID; bh=GQkpWNDJcatZ2bFfhmGbbxPa/R3MNLOL2MQxjB0R/Is=; b=BbCLGCLMoH1OctESaraEASws3C ceTUk5NsczwRuFX4L/L2i/OUW5JxlJBzpW6TMaxyX5nZNBbZgb0mUzLLp04npioZd3dNNK8YNRjq6 XP3/N0PcHzVx21AH0OZHVY8dIzad/jpT5RJFTXIxa+BON0EH9qYLkOekdfpsqtoLhuKDqLum+wCtZ IjNoM5qkKe/Mf7pkLnpt2sqzm0Dg1qWHH+O/UR22Q1/UlIoASzukGfKHI3BzFSNKLdWtK+GqXrC2O m+92+zdVoXO3gfUQeRVTkggvBmRJ7pB8+/IpmTrbOR9g3lCP0wwTvU7lwy6BM3wuUMllF4xPvk3V0 jSuogVhA==; Received: by zero.zsh.org with local id 1rw2eA-00018a-Ez; Sun, 14 Apr 2024 16:24:02 +0000 Authentication-Results: zsh.org; iprev=pass (mta03.eastlink.ca) smtp.remote-ip=24.224.136.9; dmarc=none header.from=eastlink.ca; arc=none Received: from mta03.eastlink.ca ([24.224.136.9]:44683) by zero.zsh.org with esmtps (TLS1.3:TLS_AES_128_GCM_SHA256:128) id 1rw2dQ-0000O0-2e; Sun, 14 Apr 2024 16:23:16 +0000 Received: from csp01.eastlink.ca ([71.7.199.166]) by mta03.eastlink.ca ([24.224.136.9]) with ESMTPS id <0SBX0G7KLXHA00V0@mta03.eastlink.ca> for zsh-users@zsh.org; Sun, 14 Apr 2024 13:23:15 -0300 (ADT) Received: from [192.168.0.11] (host-24-207-19-13.public.eastlink.ca [24.207.19.13]) by csp01.eastlink.ca ([71.7.199.166]) with ESMTPSA id w2dOrxTn8Aimnw2dOr1qTf (version=TLSv1_2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256); Sun, 14 Apr 2024 13:23:15 -0300 X-Authority-Analysis: v=2.4 cv=Q8Rx4J2a c=1 sm=1 tr=0 ts=661c02f2 a=e7T7DzMKK1R988ZCg0wLyw==:117 a=e7T7DzMKK1R988ZCg0wLyw==:17 a=r77TgQKjGQsHNAKrUKIA:9 a=R5ISiA5IrG4PEvHbj6QA:9 a=3ZKOabzyN94A:10 a=QEXdDO2ut3YA:10 a=pGLkceISAAAA:8 a=ULq7Je2VH0xZnxVPl2MA:9 a=3Qipc0IzUvW9IS61:21 a=_W_S_7VecoQA:10 X-Vade-Cause: gggruggvucftvghtrhhoucdtuddrgedvledrudeiledguddtfecutefuodetggdotefrodftvfcurfhrohhfihhlvgemucfgtefuvffnkffpmfdpqfgfvfenuceurghilhhouhhtmecufedttdenucenucfjughrpegtkfffgggfuffvfhfhjgesrgdtreertddvjeenucfhrhhomheptfgrhicutehnughrvgifshcuoehrrgihrghnughrvgifshesvggrshhtlhhinhhkrdgtrgeqnecuggftrfgrthhtvghrnhephfettefhveeguedvleeggfdvvedufeeuudffvdfgledvvdfgtdeigeeuueelieefnecukfhppedvgedrvddtjedrudelrddufeenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepihhnvghtpedvgedrvddtjedrudelrddufedphhgvlhhopegludelvddrudeikedrtddruddungdpmhgrihhlfhhrohhmpehrrgihrghnughrvgifshesvggrshhtlhhinhhkrdgtrgdpnhgspghrtghpthhtohepvddprhgtphhtthhopeerredprhgtphhtthhopeiishhhqdhushgvrhhsseiishhhrdhorhhgpdhgvghtqdgkihhprfgrshhsfigupehtrhhuvg X-Vade-Score: 0 X-Vade-State: 0 X-EL-AUTH: rayandrews@eastlink.ca Content-type: multipart/alternative; boundary="------------RwOU1tcaZ5Nz2ga8axNhXmjy" Message-id: <7b7aaaae-89bf-4e89-a0cc-b7697a4e1915@eastlink.ca> Date: Sun, 14 Apr 2024 09:23:13 -0700 MIME-version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: triviality regarding $# counts To: zsh-users@zsh.org References: <97793422-1543-4ba6-b52b-ff93eba03ab1@eastlink.ca> <0a0b9ec3-4661-4386-9fbf-b3152a46001e@eastlink.ca> <9416dc0a-3e41-4229-a9e1-239411ab3c17@eastlink.ca> <4a1e027c-a9d8-4306-bf3b-e1282914644c@app.fastmail.com> <4e9aa98c-9b5d-4e22-b7fc-8c50a9af9ada@eastlink.ca> <52e2a591-b083-4e50-8fed-0685d42088df@eastlink.ca> <9e41a059-c051-4124-8296-48ccd97f793c@eastlink.ca> Content-language: en-US From: Ray Andrews In-reply-to: X-Seq: 29828 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: This is a multi-part message in MIME format. --------------RwOU1tcaZ5Nz2ga8axNhXmjy Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit On 2024-04-14 08:11, Mark J. Reed wrote: > As I said about *echo* way back in my first response: the > *print* command is what is turning the backslash-n sequences into > newlines. If you use *-r* to turn off that behavior, you can see the > strings unmangled: > > % print -r $ggg > > abc\n \n def\n \n ghi\n > > > The -r is telling print not to do something it normally does. The > result is the raw string (which I think is what *-r* stands for). Ah!  Threw me off the scent there.  So print is ... yes I get it. Ok, so that's what had me fooled.  So, one more thing and then I think I'll get back to straight and level:  How do we separate the elements?  I've always seen it with ticks.  Or ... now that I think ... with $'...' Yes? If you instead do this: > > print '\n' > > Then the string you create and pass to *print* has no newline in it. > It is not one byte of value 10, but two bytes, one with value 92 > (backslash) and the second with value 110 (lowercase *n*).  The code > implementing the *print* command recognizes this sequence as code for > "print a newline", so it does. But that's the command doing that. The > string itself has no newline in it. Ok, that blows the fog away.  We have the 'real' newline, we have the string '\n' ... which print helpfully translates into the former.  Yes, if in doubt 'print -r'. Sheesh, I fall into every pothole there could possibly be. --------------RwOU1tcaZ5Nz2ga8axNhXmjy Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: 8bit

On 2024-04-14 08:11, Mark J. Reed wrote:
As I said about echo way back in my first response: the print command is what is turning the backslash-n sequences into newlines. If you use -r to turn off that behavior, you can see the strings unmangled:

print -r $ggg                             

 abc\n \n def\n \n ghi\n


The -r is telling print not to do something it normally does. The result is the raw string (which I think is what -r stands for).

Ah!  Threw me off the scent there.  So print is ... yes I get it.  Ok, so that's what had me fooled.  So, one more thing and then I think I'll get back to straight and level:  How do we separate the elements?  I've always seen it with ticks.  Or ... now that I think ... with
$'...'
Yes? 

If you instead do this:

print '\n'

Then the string you create and pass to print has no newline in it. It is not one byte of value 10, but two bytes, one with value 92 (backslash) and the second with value 110 (lowercase n).  The code implementing the print command recognizes this sequence as code for "print a newline", so it does. But that's the command doing that. The string itself has no newline in it.

Ok, that blows the fog away.  We have the 'real' newline, we have the string '\n' ... which print helpfully translates into the former.  Yes, if in doubt 'print -r'.

Sheesh, I fall into every pothole there could possibly be.



--------------RwOU1tcaZ5Nz2ga8axNhXmjy--