Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Bitwise ops in a conditional
- X-seq: zsh-users 10141
- From: "djh " <henman@xxxxxxxxxxxxxx>
- To: "zsh" <zsh-users@xxxxxxxxxx>
- Subject: Bitwise ops in a conditional
- Date: Thu, 06 Apr 2006 14:07:43
- Cc:
This should be fairly simple, but I missed something.
I want to test if a shell variable is odd or not in a conditional to generate a simple odd/even testing which seems natural to me.
I did the below:
if [[ ((index & 0x01)) .eq 1 ]] then
print "odd index processing"
else
print "even index processing
fi
Actually I thought that a simple
if [[ index & 0x01 ]] should work, but conditionaly may requie 2 args?
Any suggestions of using binary operators in conditions would be appreciated.
Thanks,
Darel Henman
Messages sorted by:
Reverse Date,
Date,
Thread,
Author