From: "René Neumann" <lists@necoro.eu>
To: zsh-users@zsh.org
Subject: Re: Incorporating (( $+commands[foo] )) into a larger "if" statement
Date: Thu, 6 Aug 2015 22:59:41 +0200 [thread overview]
Message-ID: <55C3CABD.8050406@necoro.eu> (raw)
In-Reply-To: <150806075728.ZM19287@torch.brasslantern.com>
Am 06.08.2015 um 16:57 schrieb Bart Schaefer:
> On Aug 6, 7:53am, id5 wrote:
> }
> } if [[ (( $+commands[foo] )) && ... ]]; then
> } echo yes
> } fi
>
> That doesn't work. [[ (( ... )) ]] is only parsed at all because you
> are allowed to have parenthesized subexpressions inside [[ ]], it is
> not interpreted as math in that context.
Ah, I see. I tested it beforehand, but it turned out it just seemed to
work, because in the end [[ non_empty_string ]] is true. Thanks for
pointing this out.
> I suspect you meant
>
> if (( $+commands[foo] )) && [[ ... ]]; then
Yes. Though this variant looks somewhat odd, as one is mixing (( )) and
[[ ]] in one chain...
> Aside: You somehow posted your reply with "From: id5" (no domain name in
> the email address). You should fix that.
Mhm, seems like my TB-Identities-Plugin was broken. Should be fixed now,
hopefully.
- René
prev parent reply other threads:[~2015-08-06 20:59 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-08-05 22:00 TJ Luoma
2015-08-06 1:57 ` Bart Schaefer
2015-08-06 5:53 ` id5
2015-08-06 14:57 ` Bart Schaefer
2015-08-06 20:59 ` René Neumann [this message]
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=55C3CABD.8050406@necoro.eu \
--to=lists@necoro.eu \
--cc=zsh-users@zsh.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.
Code repositories for project(s) associated with this public inbox
https://git.vuxu.org/mirror/zsh/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).