Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Number of non-empty elements
- X-seq: zsh-users 20566
- From: Jesper Nygårds <jesper.nygards@xxxxxxxxx>
- To: Zsh Users <zsh-users@xxxxxxx>
- Subject: Number of non-empty elements
- Date: Tue, 15 Sep 2015 19:15:01 +0200
- 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==
- 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
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?
Messages sorted by:
Reverse Date,
Date,
Thread,
Author