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, HTML_MESSAGE,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham autolearn_force=no version=3.4.4 Received: (qmail 12130 invoked from network); 30 Oct 2022 14:17:55 -0000 Received: from zero.zsh.org (2a02:898:31:0:48:4558:7a:7368) by inbox.vuxu.org with ESMTPUTF8; 30 Oct 2022 14:17:55 -0000 ARC-Seal: i=1; cv=none; a=rsa-sha256; d=zsh.org; s=rsa-20210803; t=1667139475; b=MmS0UD5QmoYOHVhViAehvXTdihOHsRAOBdZSskklECRTGKQhxGX7h17nF1iNBqRRGDR2PfViD/ gJrbbt46GVJ2Vd9OpwUSBxYq5NgmWcEX60nF+dUmLrFK+LynZFCsD6uTRDocVhsp7jcKPV5aW4 sCfFucRtp/vORvlM9mhvVWs6NAt8BV1DBIm5DK8F3CY5YxIwHvuVApyHu6zjygos4O+HeGrJ/Y YAIwkFaWykmgMeyA7MQQCNPARxdc4VtXf8zl/jf8CEybqkUrQKZpn20ISLFeOfMo1NtazJBulk U4ji8I03OXTJUwoE0IMOMYhgfiRljLDpz+s3kFEQZ5utYw==; 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=1667139475; bh=sMgy1VC0YnrL3H52NiNybI3xlSb3px0aUjHg2QNM5lc=; h=List-Archive:List-Owner:List-Post:List-Unsubscribe:List-Subscribe:List-Help: List-Id:Sender:Subject:From:To:MIME-Version:Date:Message-ID:Content-Type: DKIM-Signature; b=pxJmcejsy6wpkmZjnLLMBe8lFnHW5z6zS7eyBqoB131XAlsBtezWQPvAILOKu99OO+G9+V2rPh HPtU7FKgjFFsNuBKbK/rPnooQpOO6Cnrtd39HQlXdq1WOTdTzQ/jfSPxpavOlk9kNttcbL3lyR Sf4PnjhadCS38Z3NRcGDyj0T/9WuqSPTvt6yllfuNwOOCo9LZ3IlWxvfDUAIzUbQ4iPVD0HYF+ HWB8+Skk7pndU2ROGDquNmwLUPTHz+NwCD3A9t6LUkCEhF6nl9fN+bgc8vX9dIgueIo5ROpXj6 wZHXEiJhlr8DbEFo1xD04UFxODt0B+grDxwUODOmjq855g==; 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:Subject:From:To: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:In-Reply-To:References; bh=1NYnsLlfJBzKMzWkkqBV4jwGp+UtVW04wQeC0lYhvDg=; b=ifi7EAwhVIFj7kSrx8YaWm8/EH H/SEs923KwltKvRjDNDsH2853M3Jkx6F049gKmQfswbgNsCMmJfuNsX1p64EwSUjPJ6DNjSB14Tqk VbTO0CnwCeL66oEyVoygHNpbH7TOiOaj9C7x+Y5Vp79F9j1WHff8t69i7RBBIIv3U2FWlx5K3kO5q bF9owUrrjfJkMyF3mhLLCZ7tVK2zhudssM5XeC5sUPnhCKkzkp5OgsdnfjTG1lUqW8AsanvnahJqU BstF48VMVqNUt2o+cMBoWpiJHxUFD62StkZ5pX+XoV0gwGO4kxZ8vBBR4xuMIn0sYikqEGG45xxtR 41v6LwDg==; Received: by zero.zsh.org with local id 1op98M-0007n1-5X; Sun, 30 Oct 2022 14:17:54 +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]:39541) by zero.zsh.org with esmtps (TLS1.2:ECDHE-RSA-AES128-GCM-SHA256:128) id 1op97Q-00075k-TH; Sun, 30 Oct 2022 14:16:57 +0000 Received: from csp01.eastlink.ca ([71.7.199.166]) by mta04.eastlink.ca (Oracle Communications Messaging Server 8.0.2.2.20180531 64bit (built May 31 2018)) with ESMTPS id <0RKK00H58JPM5D61@mta04.eastlink.ca> for zsh-users@zsh.org; Sun, 30 Oct 2022 11:16:55 -0300 (ADT) Received: from [192.168.0.2] ([24.207.18.108]) by Eastlink with ESMTPSA id p97OoVXnjXZnZp97OoHaJp; Sun, 30 Oct 2022 11:16:55 -0300 X-Authority-Analysis: v=2.4 cv=I9+jBvsg c=1 sm=1 tr=0 ts=635e8757 a=xN66ZtSbq5jdJYpBp7G/jQ==:117 a=xN66ZtSbq5jdJYpBp7G/jQ==:17 a=r77TgQKjGQsHNAKrUKIA:9 a=a0anoPOlDtqmiWJmfMMA:9 a=QEXdDO2ut3YA:10 a=Fb3rOuiRTnqk2yOuAhIA:9 a=_W_S_7VecoQA:10 X-Vade-Cause: gggruggvucftvghtrhhoucdtuddrgedvgedruddtgdeigecutefuodetggdotefrodftvfcurfhrohhfihhlvgemucfgtefuvffnkffpmfdpqfgfvfenuceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmnecujfgurheptgfkffggfgfvhffusegrtderredtfeejnecuhfhrohhmpeftrgihucetnhgurhgvfihsuceorhgrhigrnhgurhgvfihssegvrghsthhlihhnkhdrtggrqeenucggtffrrghtthgvrhhnpeejjeffgeelkeekheeljedvkeevhfdtieevudeiudevkeevvefhkedvheegueelkeenucfkphepvdegrddvtdejrddukedruddtkeenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepihhnvghtpedvgedrvddtjedrudekrddutdekpdhhvghloheplgduledvrdduieekrddtrddvngdpmhgrihhlfhhrohhmpehrrgihrghnughrvgifshesvggrshhtlhhinhhkrdgtrgdpnhgspghrtghpthhtohepvddprhgtphhtthhopeerredprhgtphhtthhopeiishhhqdhushgvrhhsseiishhhrdhorhhgpdhgvghtqdgkihhprfgrshhsfigupehtrhhuvg X-Vade-Score: -100 X-Vade-State: 0 X-EL-AUTH: rayandrews@eastlink.ca Content-type: multipart/alternative; boundary="------------fQ0nw8m7hSeHVmVsVkpXixYT" Message-id: Date: Sun, 30 Oct 2022 07:16:54 -0700 MIME-version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.4.0 Content-language: en-US To: Zsh Users From: Ray Andrews Subject: better grammar with $# X-Seq: 28284 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. --------------fQ0nw8m7hSeHVmVsVkpXixYT Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit     output=$( eval "$@" )  # Input here is a 'find' command outputting a list of files.     tmp=( ${(f)output} )   # Count lines not characters.     linecount=$#tmp ... it seems clumsy to create 'tmp' just to count lines, can that be a bit more streamlined?  And is it lines or words there?  The output is filenames so words=lines in this case but maybe not in other cases so I'd like to be sure to have a count of lines.  Easy to get one's splitting wrong. BTW the ultimate in minutiae but the manual says: 12 Conditional Expressions A /conditional expression/ is used with the [[ compound command to test attributes of files and to compare strings. Each expression can be constructed from one or more of the following unary or binary expressions: ... and AFAICT the tests work fine with the single '[' as well. --------------fQ0nw8m7hSeHVmVsVkpXixYT Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: 8bit


    output=$( eval "$@" )  # Input here is a 'find' command outputting a list of files.
    tmp=( ${(f)output} )   # Count lines not characters.
    linecount=$#tmp

... it seems clumsy to create 'tmp' just to count lines, can that be a bit more streamlined?  And is it lines or words there?  The output is filenames so words=lines in this case but maybe not in other cases so I'd like to be sure to have a count of lines.  Easy to get one's splitting wrong.


BTW the ultimate in minutiae but the manual says:

12 Conditional Expressions

A conditional expression is used with the [[ compound command to test attributes of files and to compare strings. Each expression can be constructed from one or more of the following unary or binary expressions:

... and AFAICT the tests work fine with the single '[' as well.

--------------fQ0nw8m7hSeHVmVsVkpXixYT--