Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: better grammar with $#
- X-seq: zsh-users 28287
- From: Ray Andrews <rayandrews@xxxxxxxxxxx>
- To: zsh-users@xxxxxxx
- Subject: Re: better grammar with $#
- Date: Sun, 30 Oct 2022 10:49:59 -0700
- Archived-at: <https://zsh.org/users/28287>
- In-reply-to: <CAN=4vMq2iJCUvWmSjp5ZsF+ETRrv6WN7qYapoeToSq3f=63A=w@mail.gmail.com>
- List-id: <zsh-users.zsh.org>
- References: <a99ee704-c0b3-c0b3-7cf7-337412a83082@eastlink.ca> <CAN=4vMq2iJCUvWmSjp5ZsF+ETRrv6WN7qYapoeToSq3f=63A=w@mail.gmail.com>
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.
Messages sorted by:
Reverse Date,
Date,
Thread,
Author