From: | "Paweł Hajdan | ||
---|---|---|---|
To: | gentoo-dev@l.g.o | ||
Subject: | Re: [gentoo-dev] Re: use_echo() as a universal '?:' operator-like function | ||
Date: | Sat, 11 Sep 2010 18:10:01 | ||
Message-Id: | 4C8BC664.9040300@gentoo.org | ||
In Reply to: | [gentoo-dev] Re: use_echo() as a universal '?:' operator-like function by Jonathan Callen |
1 | On 9/11/10 11:03 AM, Jonathan Callen wrote: |
2 | > Just as a proof-of-concept, here's one implementation of such a |
3 | > function, allowing for an arbitrary number of arguments: |
4 | > |
5 | > use_echo() { |
6 | > while [[ $# -gt 1 ]]; do |
7 | > if use "$1"; then |
8 | > echo "$2" |
9 | > return |
10 | > fi |
11 | > shift 2 |
12 | > done |
13 | > [[ $# -eq 1 ]] && echo "$1" |
14 | > } |
15 | |
16 | Looks good to me. If it doesn't get included in any eclass, I will just |
17 | paste it to the chromium ebuilds. :) |
18 | |
19 | Paweł |
File name | MIME type |
---|---|
signature.asc | application/pgp-signature |
Subject | Author |
---|---|
Re: [gentoo-dev] Re: use_echo() as a universal '?:' operator-like function | Francesco R <vivo75@×××××.com> |