Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: Incorporating (( $+commands[foo] )) into a larger "if" statement
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é
Messages sorted by:
Reverse Date,
Date,
Thread,
Author