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,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 2949823E7E for ; Sat, 13 Apr 2024 22:37:21 +0200 (CEST) ARC-Seal: i=1; cv=none; a=rsa-sha256; d=zsh.org; s=rsa-20210803; t=1713040641; b=bI/03CSrDaGY/2AfVB98+1mLiPN9W9/n69mBSAhRovvuwKLo+dqYTDDYQtoZMmEz9kCM7gJh1j Za7Dy0RkyswzBIyv70e6gwDgzBtQXNlr/XDOShyz59+/ybKbOiMxqqIlvrkuGoRLD2mpyva9yn hVkatI2Fz02zssbWQsba+PyWQCVOBF0hIsbkQga9sfD0CWSEybjtOBGQNk3qym+Xvb+uuRuOod 4HU4/FDMK347BeDpwjLyg8i9ppE7sx8zNF59ndJSHQsitWuDfXS0ydOx8qKro0L2r+I2bs+Xy7 /4Zop+Z9EwRmhs11Xh5ekh0OS+pMexGV1ee7sYTnhhu3dQ==; 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-20210803; t=1713040641; bh=ZmGt7HMaReg6//J1psEhz4c4mT3rB4O3UaCByokhtBA=; h=List-Archive:List-Owner:List-Post:List-Unsubscribe:List-Subscribe:List-Help: List-Id:Sender:Content-Transfer-Encoding:Content-Type:In-Reply-To:From: References:To:Subject:MIME-Version:Date:Message-ID:DKIM-Signature; b=oPfI7v86M5pkma9yiU/FGjJzC4scKLVOzpRK//EH0wrIJMYLErExlbqxhP9JEfiUaw3L/5R+Cf gfNIbpSsVQBYwt7q/z1WSlIBMcfoYnXUZ346dTd1lt9ZQVc9Xs8d9e5ma7ZYx+bdK/wQuc43nB xX2EgYmUORQC0ejvO1c/TDAe0b3+uGcQAP7guk417WChgjhxEFn8w1QAp2tuHGDzeHo5aG2c8z RznlJ04ztLSBnYFFM7c0sRg+8kfWZ4Y7Yi7mRxsQSn3kHXJRnXe9xrGEwrlr9zV0EvA7jGrVPz 1YCgwZ8EAJapOF0IiQVv3f40yeB2Tu/WX+yjSxHZFJWJeQ==; 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:In-reply-to:From:References:To:Subject:MIME-version:Date: Message-id:Reply-To:Cc:Content-ID:Content-Description:Resent-Date:Resent-From :Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID; bh=V+Yth7VY0OSMHz7vCkthxUsF8/NOA7JrdiOmQPwD7Jw=; b=Zx9BfJ0EmtogX/D72k0h3pZq+X P19NWhowfwLpfkJbaVLbPWZmTVeZYLVQz5mfQYZdpkayQLo4vsmyV1BQKYEVK6/JPHXVOLiPvB2hY 9HU9EQIW1V77IetNcfjTwpY3O3c/zBm9Lgf98wcl5bldpwzBwgqmW6tMZLCgyesj8/mxmcubvXFAe VlOjEsgMYi9PNAP/v8+g85iPsnlqMq2VKfZVTkr3N+HYV4Wz0cgCNT7fmcfTeEP3ekxP6NR1w7dHA UI39RbtGnbVPxsEkSx2aAP/fCNFBALJFAppkMDeePWwys+mYHfqlZH4Tm1fsxnRsrlVay3sewZWzy Y2C+B+wg==; Received: by zero.zsh.org with local id 1rvk7l-0001LA-Gd; Sat, 13 Apr 2024 20:37:21 +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]:39697) by zero.zsh.org with esmtps (TLS1.3:TLS_AES_128_GCM_SHA256:128) id 1rvk7I-0000cP-8q; Sat, 13 Apr 2024 20:36:53 +0000 Received: from csp02.eastlink.ca ([71.7.199.167]) by mta01.eastlink.ca ([24.224.136.30]) with ESMTPS id <0SBW0BNXYEHZ3VU0@mta01.eastlink.ca> for zsh-users@zsh.org; Sat, 13 Apr 2024 17:36:51 -0300 (ADT) Received: from [192.168.0.11] (host-24-207-19-13.public.eastlink.ca [24.207.19.13]) by csp02.eastlink.ca ([71.7.199.167]) with ESMTPSA id vk7GrhQfw5Tsrvk7GrEDQf (version=TLSv1_2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256); Sat, 13 Apr 2024 17:36:51 -0300 X-Authority-Analysis: v=2.4 cv=deIj3mXe c=1 sm=1 tr=0 ts=661aece3 a=e7T7DzMKK1R988ZCg0wLyw==:117 a=e7T7DzMKK1R988ZCg0wLyw==:17 a=IkcTkHD0fZMA:10 a=gir0-LH0AAAA:8 a=cgAAfmmveQWxYWT98VcA:9 a=3ZKOabzyN94A:10 a=QEXdDO2ut3YA:10 a=aLewGyoHDmJ4ULJHWpSz:22 X-Vade-Cause: gggruggvucftvghtrhhoucdtuddrgedvledrudeiiedgudehgecutefuodetggdotefrodftvfcurfhrohhfihhlvgemucfgtefuvffnkffpmfdpqfgfvfenuceurghilhhouhhtmecufedttdenucenucfjughrpefkffggfgfuvfhfhfgjtgfgsehtkeertddtvdejnecuhfhrohhmpeftrgihucetnhgurhgvfihsuceorhgrhigrnhgurhgvfihssegvrghsthhlihhnkhdrtggrqeenucggtffrrghtthgvrhhnpeetfffhgfdvfeefleevlefhgeduveekudfhheehvefhkefhveeiheejjeehfeevgfenucfkphepvdegrddvtdejrdduledrudefnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehinhgvthepvdegrddvtdejrdduledrudefpdhhvghloheplgduledvrdduieekrddtrdduudgnpdhmrghilhhfrhhomheprhgrhigrnhgurhgvfihssegvrghsthhlihhnkhdrtggrpdhnsggprhgtphhtthhopedvpdhrtghpthhtohepreerpdhrtghpthhtohepiihshhdquhhsvghrshesiihshhdrohhrghdpghgvthdqkghiphfrrghsshifugepthhruhgv X-Vade-Score: 0 X-Vade-State: 0 X-EL-AUTH: rayandrews@eastlink.ca Message-id: Date: Sat, 13 Apr 2024 13:36:49 -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> <7ba17739-6024-439b-a4a7-dd88fddfa2e4@eastlink.ca> <7333cf23-1fe7-4b3d-a7c1-f07697c5f062@eastlink.ca> <1e53a3f7-9bdb-45ae-81c7-7d0ec1a6a541@app.fastmail.com> <3cc19e86-e953-4e2f-9e57-30ff84f15fdf@eastlink.ca> <0a0b9ec3-4661-4386-9fbf-b3152a46001e@eastlink.ca> Content-language: en-US From: Ray Andrews In-reply-to: Content-type: text/plain; charset=UTF-8; format=flowed Content-transfer-encoding: 8bit X-Seq: 29809 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 2024-04-13 12:45, Bart Schaefer wrote: > On Sat, Apr 13, 2024 at 11:08 AM Ray Andrews wrote: >> But I'm still not happy with the dollars. I had thought that " $'...' " was grammatical but we have " ' ' " -- meaning an empty line > There are three* forms of quoting: Many thanks, it's a brief page of explanation like this that would feature in my imaginary 'Idiot's Guide to Shells'.  It's not the sort of information you can go looking for  when you don't know it because you don't even know what you're looking for.  It must be brought to your attention. > 1) "X" -- expand variable references and other substitutions in X, but > do not split on $IFS ** > 2) 'X' -- do not do any expansions, X is literal Those two I pretty much understand -- except IFS which I've learned not to touch. > 3) $'X' -- interpret \n \t \e etc., but everything else is literal, as > is the final result This is new to me.  Never used it.  Looks useful for strings. > This is all explained in the manual section "Quoting". "typeset -p" > will output either no quoting at all, or #2, or #3, I remember chafing over that some years back. > Note that because #3 is quoting, not substitution, it does not expand > inside #1. Conversely, backticks `X` only look like quoting, they are > actually substitution equivalent to $(X) except without nesting, so > they do execute a command when appearing inside double quotes (#1). Heavy. > * Four if you count using a backslash to protect a single following character. Right. > ** $@ and $ary[@] and ${(@)ary} get special handling, their array-ness > is preserved with each element quoted separately. That needs pondering. > Let's look at your "redline" function: > ... > So you probably should have written > > redline () { echo -e "$red$*$nrm" } > > because $* is the same as $@ except without that special > interpretation inside double quotes. So, compared to the previous expansion, how would '$*' expand there?  I'm unclear as to the practical  difference. Anyway .... when my typedef -p line showed those "   ' '    " with no dollar -- which seemed to me to forbid that "   $'...'  " grammar -- what I should read is that that element has nothing quoted ergo no 'controller' -- no expansion flag -- is needed.  Yes?  IOW the dollar might have been put there, but it has no work to do so is simply omitted.  Logical.  Do I have that right, for once?