From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 19690 invoked by alias); 16 Sep 2015 05:16:35 -0000 Mailing-List: contact zsh-users-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Users List List-Post: List-Help: X-Seq: 20570 Received: (qmail 27190 invoked from network); 16 Sep 2015 05:16:34 -0000 X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,FREEMAIL_FROM, HTML_MESSAGE,T_DKIM_INVALID autolearn=ham autolearn_force=no version=3.4.0 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== MIME-Version: 1.0 X-Received: by 10.112.157.40 with SMTP id wj8mr26719095lbb.64.1442380589264; Tue, 15 Sep 2015 22:16:29 -0700 (PDT) In-Reply-To: <20150915214342.GD5696@tarsus.local2> References: <20150915214342.GD5696@tarsus.local2> Date: Wed, 16 Sep 2015 07:16:29 +0200 Message-ID: Subject: Re: Number of non-empty elements From: =?UTF-8?Q?Jesper_Nyg=C3=A5rds?= To: Zsh Users Content-Type: multipart/alternative; boundary=001a11c23c42a7778c051fd666a5 --001a11c23c42a7778c051fd666a5 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Thank you, Daniel. That works great. On Tue, Sep 15, 2015 at 11:43 PM, Daniel Shahaf wrote: > Jesper Nyg=C3=A5rds 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. > --001a11c23c42a7778c051fd666a5--