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.3 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, MAILING_LIST_MULTI,NICE_REPLY_A,RCVD_IN_DNSWL_MED autolearn=ham autolearn_force=no version=3.4.4 Received: (qmail 4260 invoked from network); 30 Oct 2022 17:50:37 -0000 Received: from zero.zsh.org (2a02:898:31:0:48:4558:7a:7368) by inbox.vuxu.org with ESMTPUTF8; 30 Oct 2022 17:50:37 -0000 ARC-Seal: i=1; cv=none; a=rsa-sha256; d=zsh.org; s=rsa-20210803; t=1667152237; b=aXGpGzwXIwyt0nvGQ3iDvmQyECfSe0fYz+tDYkq3ERVNX7ZJFMykd0cvesN9NHlTxVeQQjo9sb aAoJUlRst2YaA777r70C9UU0xvv1CcnWjbdd1HAsdQUBuSmPAZDLf2ooHcyuEBqSi/ZyZ4l8lJ +dDbaNA9r6PCb0uTtEzyTplC02D7q0kda583FQNJ1A9wnktVWAMGsLuhv1/ISKvBqhdTA2ojR2 t89036GG0bJ92rDZsfauvMhGT+Aii0UF+RUlvmpzNY+1qGtYS9wvxzSHX9pPKE7OqgkBhir/oP m0U07ZdRkOvB4rx44gDmet835pfNo73hWQw6kGewwSbyxg==; ARC-Authentication-Results: i=1; zsh.org; iprev=pass (mta04.eastlink.ca) smtp.remote-ip=24.224.136.10; 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=1667152237; bh=QLS9/19P+20aTt/4Lv97ZaUj8SWc4Psrh0eRrZP4yhk=; 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=j46R2T8qcvGBCc3OLN5iV2hZueEkIt8faUkOFxStT5OpjGv+e8W7nGevswyrA7mvRtjmsHDFU6 7yFGz1o9r0o8WA5ezN/df3rH2v/voXV1ynMRLckSaD9yh7IVGpGc8ej24IeOdpeFHfGvhqyrXl KcrDVT+iH1W2ApoptRsRIiGF+YS6aKD5vPNps1CpqNPZw3S/no0Vd6RmDQqB37GaHDXYfKovbD ogruwZM3MJurIkhz9Wl4sc/2GC3wRWHqsGWUS5ZnrYrXBfaq1R9uiQKIMxcd/om7bxIP2/iBHp 2tGXKhy3ltf3FYjHBGWS3qxOUTBWZe0xtgQruwAPkF2DhA==; 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=H8QrFEAYS0tA8ScwzbdqVUW0OvHrLYt1q1y6A8vXzR8=; b=BDGwY+YB87KW565cDgNuytBMdB VISPDVPwrJenntIzFFakaxeObhlZwyWYpqgcebqPC1HEzwcmTMp8hiiaPy0d8tAunm+dNeVDTOXh9 lPsa7PEoXMJa1uoHp5GazFUh812Vk02kljB9mXcL41YpFEiiH/sVIO1jlgM/pi5GMrHpGRYufEBb/ RB4ZqhsNuSK2kCy8nLa92doXJvbVpEDQASUS+cVJYhw2rGyqXTTXi8w4cFIS0MUjN3xNhXm04S2v5 omxKML/FCU814W8KQHRiQsjHLgjsEFhNmu0Vv9TtYrCC/zHoyxEU2c7Zbvn2c7vrAKef6vJ2ct15b WrX/QrFg==; Received: by zero.zsh.org with local id 1opCSD-000Fu1-7V; Sun, 30 Oct 2022 17:50:37 +0000 Authentication-Results: zsh.org; iprev=pass (mta04.eastlink.ca) smtp.remote-ip=24.224.136.10; dmarc=none header.from=eastlink.ca; arc=none Received: from mta04.eastlink.ca ([24.224.136.10]:35881) by zero.zsh.org with esmtps (TLS1.2:ECDHE-RSA-AES128-GCM-SHA256:128) id 1opCRd-000FCu-V9; Sun, 30 Oct 2022 17:50:02 +0000 Received: from csp02.eastlink.ca ([71.7.199.167]) by mta04.eastlink.ca (Oracle Communications Messaging Server 8.0.2.2.20180531 64bit (built May 31 2018)) with ESMTPS id <0RKK004OITQA4RV0@mta04.eastlink.ca> for zsh-users@zsh.org; Sun, 30 Oct 2022 14:50:00 -0300 (ADT) Received: from [192.168.0.2] ([24.207.18.108]) by Eastlink with ESMTPSA id pCRcoIRSbzeXppCRcotFZN; Sun, 30 Oct 2022 14:50:00 -0300 X-Authority-Analysis: v=2.4 cv=cYAU7FPM c=1 sm=1 tr=0 ts=635eb948 a=xN66ZtSbq5jdJYpBp7G/jQ==:117 a=xN66ZtSbq5jdJYpBp7G/jQ==:17 a=IkcTkHD0fZMA:10 a=hnCutHFX0xBRsHHpu4IA:9 a=QEXdDO2ut3YA:10 X-Vade-Cause: gggruggvucftvghtrhhoucdtuddrgedvgedruddtgddutdekucetufdoteggodetrfdotffvucfrrhhofhhilhgvmecugfetuffvnffkpffmpdfqfgfvnecuuegrihhlohhuthemuceftddtnecunecujfgurhepkfffgggfuffvfhfhjggtgfesthekredttdefjeenucfhrhhomheptfgrhicutehnughrvgifshcuoehrrgihrghnughrvgifshesvggrshhtlhhinhhkrdgtrgeqnecuggftrfgrthhtvghrnhepiedtjeffvefgtdehgefgteekueeggeeitedutddvvdduteetffdvveelgfeukedunecukfhppedvgedrvddtjedrudekrddutdeknecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehinhgvthepvdegrddvtdejrddukedruddtkedphhgvlhhopegludelvddrudeikedrtddrvdgnpdhmrghilhhfrhhomheprhgrhigrnhgurhgvfihssegvrghsthhlihhnkhdrtggrpdhnsggprhgtphhtthhopedvpdhrtghpthhtohepreerpdhrtghpthhtohepiihshhdquhhsvghrshesiihshhdrohhrghdpghgvthdqkghiphfrrghsshifugepthhruhgv X-Vade-Score: 0 X-Vade-State: 0 X-EL-AUTH: rayandrews@eastlink.ca Message-id: Date: Sun, 30 Oct 2022 10:49:59 -0700 MIME-version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.4.0 Subject: Re: better grammar with $# Content-language: en-US To: zsh-users@zsh.org References: From: Ray Andrews In-reply-to: Content-type: text/plain; charset=UTF-8; format=flowed Content-transfer-encoding: 8bit X-Seq: 28287 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 2022-10-30 10:29, Roman Perepelitsa wrote: > > You can combine the two expansions: > > linecount=${#${(f)output}} Nuts, I came close I tried: $#{${(f)output}} If you can replace the `find` command with a glob, it'll be simpler. Yeah, I'm migrating in that direction already. > You'll also avoid quoting issues. If your code is supposed to handle > all sorts of file names, make sure it can handle files with backslash > and line feed in their names. God knows.  I tend to crash into problems like that when they happen and deal with it at the time.  I wish there was some option to protect strings from all such issues, all the time, everywhere. > > Roman. >