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.3 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,HTML_MESSAGE,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 509A92504A for ; Fri, 16 Feb 2024 19:39:24 +0100 (CET) ARC-Seal: i=1; cv=none; a=rsa-sha256; d=zsh.org; s=rsa-20210803; t=1708108764; b=je5eGbjsgApI4QCtKRyGZa/vXOUVwD/Ux/T+AVVlb2FOW7J+Ed5inf9PESeAnpmXkzLWL0S6n5 3fg7S5DnMqExdyzIsDduzvuotwIWAmNQkrQzwOUsAKoedAn6WC/pqbM2QlyEOiB59LUZqsn66V 2npzOUDsQ2d0lDs+pHdSiu1hu3Fj5LsG7z5qmS9S27wD2X1btzqs5jbWYy2OiKRjcGjqvK6XYw LY4PXDPO/S0yFotOSXY5v3lO/UqUn+yJSh8p87vHFMOjPFrMQk3XDDTOR7gs8KX46LM9qDu6d+ daEv189OgRepW5MiKpTaJ7xLvI8Pcl31i2Lc8eZyuZvgGw==; ARC-Authentication-Results: i=1; zsh.org; iprev=pass (mail-lj1-f176.google.com) smtp.remote-ip=209.85.208.176; dkim=pass header.d=gmail.com header.s=20230601 header.a=rsa-sha256; dmarc=pass header.from=gmail.com; arc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed; d=zsh.org; s=rsa-20210803; t=1708108764; bh=DvZbsetyYF96ME0pEpjTZw4m3QpdUFR/J4OTW8xghiI=; h=List-Archive:List-Owner:List-Post:List-Unsubscribe:List-Subscribe:List-Help: List-Id:Sender:Content-Type:To:Subject:Message-ID:Date:From:In-Reply-To: References:MIME-Version:DKIM-Signature:DKIM-Signature; b=mTRBs4VjORori5bHwI63fuAs+RxdaEZpBLeq0JPPbQSlZvLMfjpl5FpMmknhTFmGxbbF4QMEJR QYHF7gOA/RHQ3W4LG6zAdSowpnyCoNtxP3M0l7LcBVD4MyIpC8axzfz5lCid2CebEv1TcETmPI 3iJD5AmmnDQmA4z6eqSa5v2UcmZfi7KFnqviSfI2Wl6vg1mEqJyCRld4RcVctt1P0sDDd2dO7k bi+07W7sWuf7NdOm3VdI/07TovuQJzZLTmDl8OYD1SS6H5uGFVDdUAIpnuWkqYi9Jer+/XRE1l GjdmWQymeyLjJcpM1HqmUAhqPU6kPEUIVpB0wnKtIKAY1Q==; 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:To:Subject:Message-ID: Date:From:In-Reply-To:References:MIME-Version:Reply-To:Cc: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID; bh=DWY0cAoNyWzHC5uXO0MH4r3ebRQG8cyazb0Sf9ZY0yQ=; b=iqv+EF6ZiNWyiHoKPSYwzX+y0w smekAguuKicDADcEwtWFuojUT7ezi1TlJezICQa7adb+5Uzbin6IwerU3B8bGAO9aVerOIhyhOkm+ 5oqbVL5ws+fZu9Zt8l4X/uPFATPGuNL3mjhyD6aUjBZCcRODr6m7s5Ym1/hEB027OFkC2poOM0MuB GagbgBn3x9g5igwSbBGOdncAnIEFVAhexF5lrS1FvpYavO6M0DSyCCr6siD6ojsEIKa9KJoGI7Yq3 btvuGEsGcehjBcz0bFmvhdlysFBuLdkLWEuPUjkd9Vn1slgEpORkmaCg2Hqx7WNvrI+8MKQAZ2xkj j7jOOFwg==; Received: by zero.zsh.org with local id 1rb37M-000KDR-KT; Fri, 16 Feb 2024 18:39:24 +0000 Authentication-Results: zsh.org; iprev=pass (mail-lj1-f176.google.com) smtp.remote-ip=209.85.208.176; dkim=pass header.d=gmail.com header.s=20230601 header.a=rsa-sha256; dmarc=pass header.from=gmail.com; arc=none Received: from mail-lj1-f176.google.com ([209.85.208.176]:53441) by zero.zsh.org with esmtps (TLS1.3:TLS_AES_128_GCM_SHA256:128) id 1rb36q-000JY8-U0; Fri, 16 Feb 2024 18:38:54 +0000 Received: by mail-lj1-f176.google.com with SMTP id 38308e7fff4ca-2d109e7bed2so29764011fa.2 for ; Fri, 16 Feb 2024 10:38:52 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1708108731; x=1708713531; darn=zsh.org; h=to:subject:message-id:date:from:in-reply-to:references:mime-version :from:to:cc:subject:date:message-id:reply-to; bh=DWY0cAoNyWzHC5uXO0MH4r3ebRQG8cyazb0Sf9ZY0yQ=; b=l2JVRtm9iJWLykZWqGMJrM+i5pWkJetJVp3J+ZE2U4Ew0rGwcbKO+vC4/3Xs+2n9O4 LtegZWC2g12PKRppKwmm/pvAmGYdMg8TMgKoNExatmkrA748PPFCU+p1NnEg4MhwJ+wI qmVj1sUXcHFFHye4aC4jaj7PxyRzTjd8M0nP68hdtvnKas0pVk3z5eRmFd+4pSABENIz NvIzPYPOlLsItlYHh9jYgntyAmY5zPTrO5cyj1EOXAs6eX46CcTJxs0lYVbQkVBZR96L ew6qZ6pbN8zdxPOn/1+CVPv97QjFZ+g/XrxOVib/7+CrbQUCOJ3Mmp9QZ3M++qr/WJfH ifRQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1708108731; x=1708713531; h=to:subject:message-id:date:from:in-reply-to:references:mime-version :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=DWY0cAoNyWzHC5uXO0MH4r3ebRQG8cyazb0Sf9ZY0yQ=; b=VONcXTmw4MvVs5ohVA04p5wzwhxfg+UKPEnzfL2xk680t67lSrK5QWBURNwzglXLBx xFN/NKs8wWgN8eT5UmuCO3teoPM/vec42SQjcrQll/8Tuip/ADOAyG/XRAqSEL6StMNU c4tSypn3sMGg5WSEnFxVZ1s4/CMCN59SKWBgqWSXHr/SqMw+8EHC9XQ3EJ/PxsVmWM2N nuCDlJ7Fey0TwrBsIar+PYhV5ZulIrsfgykdIwEK0NaBHuARFPAfQ42WdjQixsf94sE5 eqoXRYlIRewlS9+yXfm+4782G9zRVrMg+MQ46l1mYpO2dl7ixH63vZz6JPKAJaR1L+HS 9+pg== X-Gm-Message-State: AOJu0Yy5mxcxWRNio7QpUuSOwSlOHrS96xtNltFa5+3adhZgS1wEbFS0 cHWNXLF94p/MWEg0/q+5VleTar9lspuCPkx8RzujBWpybglXBWYb4K48Q+Rw1u2LNC8bcecUx7t 52QeZkp+ISBJWtY120hj0tg8ktLsQf9Zng2E= X-Google-Smtp-Source: AGHT+IFGHjbfdW544iiNalUVvTo76e4zgVi7eKJ+tnho8WWlShgSh/jNmZLciOUZw9wXYrn+75J3ChbUDW2oIVdGmcU= X-Received: by 2002:a2e:bc29:0:b0:2d2:1e1e:1302 with SMTP id b41-20020a2ebc29000000b002d21e1e1302mr1562752ljf.10.1708108731257; Fri, 16 Feb 2024 10:38:51 -0800 (PST) MIME-Version: 1.0 References: <8fc8b27a-9f1b-4d7f-8865-cbf41cc7374e@app.fastmail.com> In-Reply-To: From: "Mark J. Reed" Date: Fri, 16 Feb 2024 13:38:38 -0500 Message-ID: Subject: Re: Counting characters in command output? To: zsh-users@zsh.org Content-Type: multipart/alternative; boundary="0000000000002a1b660611840eac" X-Seq: 29684 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: --0000000000002a1b660611840eac Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable 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 Is it also the case that *${ command}* runs in the current shell rather than a subshell and can therefore have side effects (if it's a function/builtin, of course)? I seem to recall seeing that syntax used that way before, but it may have been in a different shell. On Fri, Feb 16, 2024 at 1:03=E2=80=AFPM Bart Schaefer wrote: > On Thu, Feb 15, 2024 at 8:55=E2=80=AFPM Lawrence Vel=C3=A1zquez wrote: > > > > + 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. > > That's not quite accurate, though. > > % print -l ${|reply| reply=3D(a b c)} > a > b > c > > It's only ${| REPLY=3D...} and ${ command } that always behave like scala= rs. > > Even ${| REPLY=3D(a b c)} behaves like a scalar (joins the array), which > I suppose is also worth mentioning. Will consider wording over the > weekend when I have more time. > > --=20 Mark J. Reed --0000000000002a1b660611840eac Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
On Thu, Feb 15, 2024, a= t 8:53 PM, Bart Schaefer wrote:
> If you want command substitution withou= t word splitting, then in
> whatever the next version ends up being calle= d you have
>=C2=A0 =C2=A0 ${ command }
> to do that for you
<= br>Is it also the case that ${ command} runs in the current shell ra= ther than a subshell and can therefore have side effects (if it's a fun= ction/builtin, of course)? I seem to recall seeing that syntax used that wa= y before, but it may have been in a different shell.

On Fri, Feb 16, 2024 at= 1:03=E2=80=AFPM Bart Schaefer <schaefer@brasslantern.com> wrote:
On Thu, Feb 15, 2024 at 8:55=E2=80=AFPM Lawre= nce Vel=C3=A1zquez <= larryv@zsh.org> wrote:
>
> +=C2=A0 Unless enclosed in double quotes, the expansion of mytt($(comm= and)) is
> +=C2=A0 split on mytt(IFS).=C2=A0 In contrast, and contrary to bash an= d ksh, unquoted
> +=C2=A0 mytt(${ command }) and its variants are not split unless the > +=C2=A0 mytt(SH_WORD_SPLIT) option is set.

That's not quite accurate, though.

% print -l ${|reply| reply=3D(a b c)}
a
b
c

It's only ${| REPLY=3D...} and ${ command } that always behave like sca= lars.

Even ${| REPLY=3D(a b c)} behaves like a scalar (joins the array), which I suppose is also worth mentioning.=C2=A0 Will consider wording over the weekend when I have more time.



--
Ma= rk J. Reed <mar= kjreed@gmail.com>
--0000000000002a1b660611840eac--