From: Ray Andrews <rayandrews@eastlink.ca>
To: zsh-users@zsh.org
Subject: Re: Counting characters in command output?
Date: Wed, 14 Feb 2024 08:30:27 -0800 [thread overview]
Message-ID: <58e3e416-1e9f-424c-b9af-b96b93dc9938@eastlink.ca> (raw)
In-Reply-To: <CAA=-s3yahhzqxELBD=oWy_OjLcbL_N9cu5y-PwJ_qOdYcKm6dA@mail.gmail.com>
[-- Attachment #1: Type: text/plain, Size: 1375 bytes --]
On 2024-02-14 07:58, Mark J. Reed wrote:
> > I myself almost always want lines. Or elements. Sometimes words,
> almost never characters.
>
> As I said, it's the consistency.
Right. That would be second on my list of vectors and should trump
tradition, especially when, as Roman says, most users don't prefer the
status quo.
> If you have a scalar parameter named *foo*, *$#foo* is the number of
> characters. If it's an array, *$#foo* is the number of elements. The
> key point in my mind is that when you assign a parameter from command
> substitution, e.g. *foo=$(bar)*, then what you get is a scalar
> parameter, not an array. You /can/ get an array instead, but you have
> to ask for it explicitly by putting extra parentheses around the right
> hand side: *foo=($(bar))*. So parameter assignment defaults to scalar
> mode and requires extra punctuation to do array mode. But directly
> counting the result of the substitution with no intervening parameter
> defaults to array mode and requires extra punctuation to do scalar mode.
So really there is a logical problem too. We have another 'invisible'
transformation. We 'have' quarts but liters are what's counted, yes?
> I would in general have expected *foo $(bar) * to behave
identically to *baz=$(bar); foo $baz*.
Yes, it would be non-negotiable in algebra. a=b; b=c; ergo a=c.
[-- Attachment #2: Type: text/html, Size: 2263 bytes --]
next prev parent reply other threads:[~2024-02-14 16:31 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-02-13 20:38 Mark J. Reed
2024-02-13 20:41 ` Roman Perepelitsa
2024-02-14 0:45 ` Mark J. Reed
2024-02-14 6:49 ` Roman Perepelitsa
2024-02-14 13:56 ` Mark J. Reed
2024-02-14 15:36 ` Ray Andrews
2024-02-14 15:58 ` Mark J. Reed
2024-02-14 16:30 ` Ray Andrews [this message]
2024-02-15 14:34 ` Lawrence Velázquez
2024-02-15 9:50 ` Roman Perepelitsa
2024-02-15 14:30 ` Lawrence Velázquez
2024-02-15 15:29 ` Ray Andrews
2024-02-15 16:16 ` Roman Perepelitsa
2024-02-15 16:55 ` Ray Andrews
2024-02-15 14:53 ` Ray Andrews
2024-02-16 1:53 ` Bart Schaefer
2024-02-16 4:53 ` Lawrence Velázquez
2024-02-16 18:03 ` Bart Schaefer
2024-02-16 18:38 ` Mark J. Reed
2024-02-16 19:36 ` Bart Schaefer
2024-02-16 19:37 ` Lawrence Velázquez
2024-02-16 21:06 ` Mikael Magnusson
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=58e3e416-1e9f-424c-b9af-b96b93dc9938@eastlink.ca \
--to=rayandrews@eastlink.ca \
--cc=zsh-users@zsh.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.vuxu.org/mirror/zsh/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).