Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: trapped in bash
- X-seq: zsh-users 22228
- From: Jim <linux.tech.guy@xxxxxxxxx>
- To: zsh-users@xxxxxxx
- Subject: Re: trapped in bash
- Date: Sat, 17 Dec 2016 17:16:12 -0600
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:reply-to:in-reply-to:references:from:date:message-id :subject:to; bh=0JZBJo1OIJiWcUvpaSvW8LmJCRHNsase9N5InUbLqT0=; b=JojJxKq8rNlthSiBcCanq3BiRKiLvlEFczc+/0hLPsMb1deaoPMg5w7yCfVHwXfkmw N/+GxFbe6CjaAJJdEN2uXSLcndE24/P7eROBqOpwnw/YC1OaDCQB/J24nLBy0jxwySb8 JLyHL0wBuBijIHoDU2Bwxr/E5GeR0ugptvNkuC2Yq/78p+cYAWLTH5Dihoq4Y1mcIUnV 2b192wJuKo9iBD6VW8Wd4Y+WnVBYdlVn6Pbt5/WF6umhjPHKhWxNIeUNtGnaXMi75TSF St0TfVSt7HHwSzObmXFflUxGwmqFOXPa+y2AZfhSRVNxlXUMwe6pSzDFgduSRVuGs9ZG +vzg==
- In-reply-to: <58540944.3030706@eastlink.ca>
- List-help: <mailto:zsh-users-help@zsh.org>
- List-id: Zsh Users List <zsh-users.zsh.org>
- List-post: <mailto:zsh-users@zsh.org>
- Mailing-list: contact zsh-users-help@xxxxxxx; run by ezmlm
- References: <58540944.3030706@eastlink.ca>
- Reply-to: linuxtechguy@xxxxxxxxx
On Fri, Dec 16, 2016 at 9:33 AM, Ray Andrews <rayandrews@xxxxxxxxxxx>
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
Messages sorted by:
Reverse Date,
Date,
Thread,
Author