From: Jim <linux.tech.guy@gmail.com>
To: zsh-users@zsh.org
Subject: Re: trapped in bash
Date: Sat, 17 Dec 2016 17:16:12 -0600 [thread overview]
Message-ID: <CA+rB6GKuS8w3DHiE-r9Da5-bbmBNqSYWc0myLp=Xab=cr_UEbQ@mail.gmail.com> (raw)
In-Reply-To: <58540944.3030706@eastlink.ca>
[-- Attachment #1: Type: text/plain, Size: 592 bytes --]
On Fri, Dec 16, 2016 at 9:33 AM, Ray Andrews <rayandrews@eastlink.ca>
wrote:
>
> BTW:
>
> _array=( ${(f)_variable} )
> _count=$#_array # Count the number of lines.
>
> Can that be simplified? I don't need the _array, just the _count. Of
> course there are any number of utilities to count lines, but I mean the
> simplest zsh way, although the above is nicely self-explanatory
_count=${#${(f)_variable}}
This will remove the need for the variable _array. One caution, if your
not already aware, (f) removes blank lines, so they won't show up in
the count.
Hope this helps,
Jim
next prev parent reply other threads:[~2016-12-17 23:16 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-12-16 15:33 Ray Andrews
2016-12-16 21:51 ` Aaron Schrab
2016-12-16 22:39 ` Ray Andrews
2016-12-16 23:05 ` Bart Schaefer
2016-12-17 20:27 ` Ray Andrews
2016-12-17 20:43 ` Bart Schaefer
2016-12-17 22:40 ` Ray Andrews
[not found] ` <5855BEF2.6090208__18199.534857604$1482015164$gmane$org@eastlink.ca>
2016-12-18 15:06 ` Daniel Shahaf
2016-12-18 15:54 ` Ray Andrews
2016-12-19 0:32 ` Daniel Shahaf
2016-12-19 2:30 ` Bart Schaefer
2016-12-19 4:29 ` Ray Andrews
2016-12-19 5:48 ` Bart Schaefer
2016-12-19 16:26 ` Ray Andrews
[not found] ` <ab7aeb33-d091-6602-8baa-cce92300d289__26556.3400615521$1482166729$gmane$org@eastlink.ca>
2016-12-19 17:47 ` Daniel Shahaf
2016-12-17 23:16 ` Jim [this message]
2016-12-17 23:38 ` Ray Andrews
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='CA+rB6GKuS8w3DHiE-r9Da5-bbmBNqSYWc0myLp=Xab=cr_UEbQ@mail.gmail.com' \
--to=linux.tech.guy@gmail.com \
--cc=linuxtechguy@gmail.com \
--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).