I do the stupid so you don’t have to

So you want to use bc for some hexadecimal maths. You set the input base:

ibase=16

and the output base:

obase=16

Oops! I just set it to output in base 22. I’d already set it to think numbers were input in hexadecimal, and that’s how it handled the “16” in my obase command. Either do this:

ibase=16
obase=10

Or this:

obase=16
ibase=16

About Graham

I make it faster and easier for you to create high-quality code.
This entry was posted in UNIX. Bookmark the permalink.