public inbox for gentoo-dev@lists.gentoo.org
 help / color / mirror / Atom feed
From: "Marijn Schouten (hkBst)" <hkBst@gentoo.org>
To: gentoo-dev@lists.gentoo.org
Subject: Re: [gentoo-dev] More general interface to use flags
Date: Fri, 02 Nov 2007 15:27:35 +0100	[thread overview]
Message-ID: <472B33D7.7070906@gentoo.org> (raw)
In-Reply-To: <1194012241.16055.11.camel@uberlaptop.marples.name>

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Roy Marples wrote:
> On Fri, 2007-11-02 at 14:44 +0100, Marijn Schouten (hkBst) wrote:
>> [[ ${flag} = !* ]] && { success=1 ; flag=${flag:1} }
> 
> Could be written as
> [ "${flag#!}" != "${flag}" ] && { success=1; flag=${flag#!}; }
> 
>> string=$( (( ${success} == 0 )) && echo ${string_success} || echo
>> ${string_failure} )
>>     [[ -n ${string} ]] && echo ${string}
> 
> if [ "${success}" = "0" ]; then
>    string=${string_success}
> else
>    string=${string_failure}
> fi
> [ -n "${string}" ] && echo "${string}"

Actually I'd prefer to introduce

ifz() {
    [[ $1 = 0 ]] && echo $2 || echo $3
}

and reimplement as follows

string=$(ifz ${success} "${string_success}" "${string_failure}")

but I don't want to push my luck,

Marijn

- --
Marijn Schouten (hkBst), Gentoo Lisp project
<http://www.gentoo.org/proj/en/lisp/>, #gentoo-lisp on FreeNode
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.7 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFHKzPXp/VmCx0OL2wRAhvNAKCB5yPezkffi/QXx6aDEXsgB662kwCfb3DV
SDZ66FZzdoSF3uftGd+ZBik=
=ylxW
-----END PGP SIGNATURE-----
-- 
gentoo-dev@gentoo.org mailing list



  reply	other threads:[~2007-11-02 14:28 UTC|newest]

Thread overview: 41+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-11-02 13:44 [gentoo-dev] More general interface to use flags Marijn Schouten (hkBst)
2007-11-02 14:04 ` Roy Marples
2007-11-02 14:27   ` Marijn Schouten (hkBst) [this message]
2007-11-02 14:52     ` Roy Marples
2007-11-02 14:59   ` Mike Frysinger
2007-11-02 15:30     ` Roy Marples
2007-11-02 15:38       ` Mike Frysinger
2007-11-02 15:48         ` Roy Marples
2007-11-02 15:58           ` Mike Frysinger
2007-11-02 16:10             ` Roy Marples
2007-11-02 16:30               ` Bo Ørsted Andresen
2007-11-02 16:52                 ` Roy Marples
2007-11-02 17:17                   ` Bo Ørsted Andresen
2007-11-02 17:35                     ` Roy Marples
2007-11-03  0:19                       ` [gentoo-dev] POSIX shell and "portable" Fabian Groffen
2007-11-03  0:47                         ` Roy Marples
2007-11-05  9:22                           ` Michael Haubenwallner
2007-11-05 10:13                             ` Roy Marples
2007-11-05 13:21                               ` Michael Haubenwallner
2007-11-05 20:21                                 ` Mike Frysinger
2007-11-05 23:18                                   ` Roy Marples
2007-11-06  7:12                                     ` Ciaran McCreesh
2007-11-06  7:40                                       ` Roy Marples
2007-11-06  8:03                                         ` Ciaran McCreesh
2007-11-06  8:25                                           ` Roy Marples
2007-11-06  9:04                                     ` Michael Haubenwallner
2007-11-05 20:32                                 ` Roy Marples
2007-11-05 20:55                                   ` Fabian Groffen
2007-11-05 22:27                                   ` Mike Frysinger
2007-11-03  0:57                         ` Natanael copa
2007-11-03  1:06                         ` Roy Marples
2007-11-03 16:19                           ` [gentoo-dev] " Steve Long
2007-11-03  1:10                         ` [gentoo-dev] " Roy Marples
     [not found]                       ` <b41005390711022225i4f30bb01jbf5a040c60c4b088@mail.gmail.com>
2007-11-03  5:26                         ` Fwd: [gentoo-dev] More general interface to use flags Alec Warner
2007-11-03 21:57                           ` Mike Frysinger
2007-11-04 10:54 ` [gentoo-dev] " Steve Long
2007-11-04 21:54   ` Alec Warner
2007-11-06 11:50     ` Steve Long
     [not found] <472B2969.1070701@gentoo.org>
2007-11-02 14:18 ` [gentoo-dev] " Daniel Drake
2007-11-02 14:52   ` Marijn Schouten (hkBst)
2007-11-02 14:53   ` Marijn Schouten (hkBst)

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=472B33D7.7070906@gentoo.org \
    --to=hkbst@gentoo.org \
    --cc=gentoo-dev@lists.gentoo.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.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox