[prog] Reading data file

dominik.schramm at gmxpro.net dominik.schramm at gmxpro.net
Sat Jan 24 01:50:21 EST 2004


Hi,

"Daniel." <cristofd at hevanet.com> writes:
> If the problem is extracting individual flags from the 32-bit
> messageflags variable, you use a bitwise and. In bash I think this
> would look like
> let "REPLIEDFLAG = ($MSGFLAGS & 16)/16"
> let "FORWARDEDFLAG = ($MSGFLAGS & 32)/32"

Ahem, the correct syntax is:
REPLIEDFLAG=$((($MSGFLAGS & 16) / 16))

i.e.: no "let", no spaces around "=", and the calculation inside $(()).
Also worth noting: this works in bash, not in sh.

regards
dominik

-- 
Dominik Schramm <dominik.schramm at gmxpro.net>
pgp key available via e-mail, web, and FTP from 
http://www.cam.ac.uk.pgp.net/pgpnet/wwwkeys.html



More information about the Programming mailing list