Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: Number of non-empty elements
- X-seq: zsh-users 20567
- From: Daniel Shahaf <d.s@xxxxxxxxxxxxxxxxxx>
- To: Jesper Nygårds <jesper.nygards@xxxxxxxxx>
- Subject: Re: Number of non-empty elements
- Date: Tue, 15 Sep 2015 21:43:42 +0000
- Cc: Zsh Users <zsh-users@xxxxxxx>
- Dkim-signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d= daniel.shahaf.name; h=cc:content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:references :subject:to:x-sasl-enc:x-sasl-enc; s=mesmtp; bh=hHf5pvUC4WiFgQ9s IeZ7WgKgKMY=; b=JGyallKwzqQJNtucFEQSR4VD2ph6NJPkF9o0xArUzJOYcqUb fnCiyrK45nU72Dc+JmPaPyXWRcfbLZJ5fo8jtyKtFAa2o0sOASB5/IoPQKvXyHMV AfTK0+OR8Y3cCmLc4RWVhk1b7NJ+QDn4vnN2ieWYaP0gMBxqPlZ3z9Rm9ZA=
- Dkim-signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:references :subject:to:x-sasl-enc:x-sasl-enc; s=smtpout; bh=hHf5pvUC4WiFgQ9 sIeZ7WgKgKMY=; b=d2KBoDqeRFtgjSU7AAMwOYzHzOkIE0oUW6+l57rHYechWIr hLDxh2bolFzu4Edk67ZhcAxqubELyaf16x2gFi2/Ngk8A324SC8So9MFnnKhduMd P0PYvnfzAY4rG5QiwTeQTSLVhEHXYy8jrU/zhWdF1PaMMSqgidBJ2P8Ln3s4=
- In-reply-to: <CABZhJg_M5AF2i+RyPe2RHMhY+M_it_Y9Kebfy05o59qy1v-jqQ@mail.gmail.com>
- 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>
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