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.5 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,DKIM_VALID_EF,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED, T_SCC_BODY_TEXT_LINE 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 BEA572404D for ; Fri, 16 Feb 2024 05:56:09 +0100 (CET) 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-Type:Subject:Cc:To:From:Date: References:In-Reply-To:Message-Id:MIME-Version:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID; bh=bX815sS0FHlrGZeTTu8CHIB8ftUjSg6mkJJac4twgEw=; b=APb5CsDRMA+3XC/z3nFFPo3SpF 2RJKBZ2jH62C2uHLolnPj8qMusnWHL08jwYi1KNdk2mSzJ8uN2QnMg7N69DL6w3IK1VJR/6Ahn70t 1r1sryBdbuvh4cz3v4Q/JG2zfgRYRV3WzfE8pfbuSKfDPyaTYm7ybULXQAGi9RFjfBdQjxhPcmzzo mfddflU0urn6z648ywtDyzhZvnAsGHs6nDsjMkiKfLsRQaPg6f+tuZ/rvGtcP/zeSyUo4zj4Wm08h t0/f7qLo6GPPF2vDvK5S1mIguxIBVsNm5WYuEUn5xgYI685IwolIXcaup+M6CzAQ2CTjVR1yfUHCt odbadHmw==; Received: by zero.zsh.org with local id 1raqGf-000JDY-AA; Fri, 16 Feb 2024 04:56:09 +0000 Received: by zero.zsh.org with esmtpsa (TLS1.3:TLS_AES_256_GCM_SHA384:256) id 1raqFv-000IWY-Qc; Fri, 16 Feb 2024 04:55:24 +0000 Received: from compute2.internal (compute2.nyi.internal [10.202.2.46]) by mailfauth.nyi.internal (Postfix) with ESMTP id E37DE1200043; Thu, 15 Feb 2024 23:55:21 -0500 (EST) Received: from imap48 ([10.202.2.98]) by compute2.internal (MEProxy); Thu, 15 Feb 2024 23:55:21 -0500 X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvledrvddugdejkecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpefofgggkfgjfhffhffvvefutgesthdtredtreerjeenucfhrhhomhepnfgrfihr vghntggvucggvghljoiiqhhuvgiiuceolhgrrhhrhihvseiishhhrdhorhhgqeenucggtf frrghtthgvrhhnpeelkeehjefgudefgeekueegudeghfevvdeljeehieeuffehveejgfeh tefhudevhfenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhroh hmpehlrghrrhihvhdomhgvshhmthhprghuthhhphgvrhhsohhnrghlihhthidqudduhedu keejjedtgedqudduledvjeefkeehqdhlrghrrhihvheppeiishhhrdhorhhgsehfrghsth hmrghilhdrtghomh X-ME-Proxy: Feedback-ID: iaa214773:Fastmail Received: by mailuser.nyi.internal (Postfix, from userid 501) id 89F5531A0065; Thu, 15 Feb 2024 23:55:21 -0500 (EST) X-Mailer: MessagingEngine.com Webmail Interface User-Agent: Cyrus-JMAP/3.11.0-alpha0-144-ge5821d614e-fm-20240125.002-ge5821d61 MIME-Version: 1.0 Message-Id: <8fc8b27a-9f1b-4d7f-8865-cbf41cc7374e@app.fastmail.com> In-Reply-To: References: Date: Thu, 15 Feb 2024 23:53:26 -0500 From: =?UTF-8?Q?Lawrence_Vel=C3=A1zquez?= To: "Bart Schaefer" Cc: zsh-users@zsh.org Subject: Re: Counting characters in command output? Content-Type: text/plain X-Seq: 29682 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 Thu, Feb 15, 2024, at 8:53 PM, Bart Schaefer wrote: > If you want command substitution without word splitting, then in > whatever the next version ends up being called you have > ${ command } > to do that for you Hm, I wasn't aware of this detail. I see it's mentioned in zshexpn(1) but don't see anything in the FAQ. Worth mentioning? diff --git a/Etc/FAQ.yo b/Etc/FAQ.yo index 7d46e9192..d8c1fe2dd 100644 --- a/Etc/FAQ.yo +++ b/Etc/FAQ.yo @@ -1081,6 +1081,11 @@ sect(Comparisons of forking and non-forking command substitution) bash and ksh, so in emulation modes, newlines are stripped from command output (not from mytt(REPLY) assignments). + Unless enclosed in double quotes, the expansion of mytt($(command)) is + split on mytt(IFS). In contrast, and contrary to bash and ksh, unquoted + mytt(${ command }) and its variants are not split unless the + mytt(SH_WORD_SPLIT) option is set. + When mytt(command) is myem(not) a builtin, mytt(${ command }) does fork, and typically forks the same number of times as mytt($(command)), because in the latter case zsh usually optimizes the final fork into an exec. -- vq