From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 472 invoked by alias); 15 Sep 2015 17:15:06 -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: 20566 Received: (qmail 4595 invoked from network); 15 Sep 2015 17:15:05 -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:date:message-id:subject:from:to:content-type; bh=pKEn+pZchYol2yk6t5lX9XDpai50sFLAlMb13TPq85s=; b=mo+ETCZI8FxX0IHAH7ihLOhrHng1b+mQVe7i3gOC8IRctx11I60EnYacgecb5s+bl7 /IVNcaLaSyHC1RlE+hfIMrPiNqhH/KI3Q3eIRVT5Co6XOLhj/QKzCFC+OjO05T/P/3SH VGkSYjfQtqKOWeZnySzsXGs+X+cfuodaXE2MPARIHipdUZIIGASKA/fBJP9Ul7UZ2qD1 O/CQhUMCoIuQXrwx9y2SZUSuJ15wWUzkx/WwgFutyl9yUAvEw5zQIs6Wmy0/7C0oKig0 R5KeWZT3q5/anRLNZbvrQz/xZiWFGy1RFXjvrn30+vGeT3OcJUXgkDgfxZtTKlELVYyr hYFg== MIME-Version: 1.0 X-Received: by 10.112.170.103 with SMTP id al7mr23193998lbc.66.1442337301058; Tue, 15 Sep 2015 10:15:01 -0700 (PDT) Date: Tue, 15 Sep 2015 19:15:01 +0200 Message-ID: Subject: Number of non-empty elements From: =?UTF-8?Q?Jesper_Nyg=C3=A5rds?= To: Zsh Users Content-Type: multipart/alternative; boundary=001a11c2381879dad1051fcc5221 --001a11c2381879dad1051fcc5221 Content-Type: text/plain; charset=UTF-8 Here's a very little thing that's annoying me. 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. This is the best I've come up with so far: mylines=... mylines=(${mylines}) # Remove empty elements return $(( ${#mylines} == 0 )) I particularly dislike that I have a separate line to remove empty lines. Is there a more elegant, preferably one-line, solution to achieve this? --001a11c2381879dad1051fcc5221--