zsh-users
 help / color / mirror / code / Atom feed
From: "Jesper Nygårds" <jesper.nygards@gmail.com>
To: Zsh Users <zsh-users@zsh.org>
Subject: Re: Number of non-empty elements
Date: Wed, 16 Sep 2015 07:16:29 +0200	[thread overview]
Message-ID: <CABZhJg9iLYO3Egj2gbVHKrRVXgusP-=tDPShs6g6ygk1qjYOyg@mail.gmail.com> (raw)
In-Reply-To: <20150915214342.GD5696@tarsus.local2>

[-- Attachment #1: Type: text/plain, Size: 620 bytes --]

Thank you, Daniel. That works great.


On Tue, Sep 15, 2015 at 11:43 PM, Daniel Shahaf <d.s@daniel.shahaf.name>
wrote:

> Jesper Nygårds wrote on Tue, Sep 15, 2015 at 19:15:01 +0200:
> > I have a fairly long function where the result is stored in an array
> called
> > "mylines".
> >
> > I want the function to return normally (status zero) if "mylines"
> contains
> > at least one non-empty element, and with non-zero otherwise.
>
>     return $(( $mylines[(I)?*] > 0 )0
>
> The (I) modifier interprets the key as a pattern and returns the highest
> index of a match, or 0 if there was no match.
>

      reply	other threads:[~2015-09-16  5:16 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-09-15 17:15 Jesper Nygårds
2015-09-15 21:43 ` Daniel Shahaf
2015-09-16  5:16   ` Jesper Nygårds [this message]

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='CABZhJg9iLYO3Egj2gbVHKrRVXgusP-=tDPShs6g6ygk1qjYOyg@mail.gmail.com' \
    --to=jesper.nygards@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).