Printable Version of Topic

Click here to view this topic in its original format

Linuxhelp _ Tips and Tricks _ Doing Binary Arithmetic

Posted by: jem Apr 25 2004, 05:56 PM

Hi All
I want to AND two binary numbers (eg 1001011 AND 1110010 to get 1000010). Are there any tools available to do this from a shell script?

Posted by: jem Apr 25 2004, 06:13 PM

http://www.freeos.com/guides/lsst/ch04sec14.html uses "bc".
bc can calculate with binary numbers using the -ibase=2 switch but it can't do a logical AND on them.

Powered by Invision Power Board (http://www.invisionboard.com)
© Invision Power Services (http://www.invisionpower.com)