Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: Number of non-empty elements
- X-seq: zsh-users 20570
- From: Jesper Nygårds <jesper.nygards@xxxxxxxxx>
- To: Zsh Users <zsh-users@xxxxxxx>
- Subject: Re: Number of non-empty elements
- Date: Wed, 16 Sep 2015 07:16:29 +0200
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; bh=ePM23so/A4d07Xyt4GiS4LXILziBwmt2eU5ceIC4p6U=; b=j+kAMbSG53SnGKLZkJKNQPGFdLgkwh8HpXyA+sDTnfQ+lGrkxUVVyV9JqrbCO12J7g UEAbUaTygCcBNlJEve+LrJVYk4jRLqJpljZloQ+mFkwaba4NsmQxSz/L8cXFgu2p4s/P IvS9cARsivbb0blIf5gkLFU5gg8qS+rMQE/3zVWd5RRhCsbYDTJ1vVN8NOwSO8Rp+x7K uoAEjS4Jb7aSrx8UzKVlW+u/vIhXx3KGYleemAsdUwMFo3PAK/kV0110iJVMLl46waUn aMNwbYxkcyVlkp5bDR7gd85/lxn3BbeB7xljXr6zDi13hgaDYHtxrKPIPW8PZ6ejZlSA 4EhA==
- In-reply-to: <20150915214342.GD5696@tarsus.local2>
- 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: <CABZhJg_M5AF2i+RyPe2RHMhY+M_it_Y9Kebfy05o59qy1v-jqQ@mail.gmail.com> <20150915214342.GD5696@tarsus.local2>
Thank you, Daniel. That works great.
On Tue, Sep 15, 2015 at 11:43 PM, Daniel Shahaf <d.s@xxxxxxxxxxxxxxxxxx>
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.
>
Messages sorted by:
Reverse Date,
Date,
Thread,
Author