From: Daniel Shahaf <d.s@daniel.shahaf.name>
To: "Jesper Nygårds" <jesper.nygards@gmail.com>
Cc: Zsh Users <zsh-users@zsh.org>
Subject: Re: Number of non-empty elements
Date: Tue, 15 Sep 2015 21:43:42 +0000 [thread overview]
Message-ID: <20150915214342.GD5696@tarsus.local2> (raw)
In-Reply-To: <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.
next prev parent reply other threads:[~2015-09-15 21:43 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 [this message]
2015-09-16 5:16 ` Jesper Nygårds
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=20150915214342.GD5696@tarsus.local2 \
--to=d.s@daniel.shahaf.name \
--cc=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).