‘bc’ is really cool application in Linux/Unix. it provides lots of convenient functions without launching GUI calculator.
One thing sometimes necessary is a conversion for the calculation. Mostly converting hexadecimal and decimal.
If you want to use hexadecimal for the input, you can use ‘ibase=16’ and below value will be all treated as 16base.
$ bc ibase=16 EA8-E98 16 ea8-e98 0
http://pagead2.googlesyndication.com/pagead/show_ads.js
One thing careful is don’t use lowercase for the hexadecimal characters. All needs to be upper case. If you want to put the results in hexadecimal as well, you can use ‘obase=16’.
$ bc obase=16 ibase=16 EA8-E98 10 ea8-e98 0
You shouldn’t use obase=16 after ibase=16 which will treat 16 as hexadecimal value 16 (22 in decimal).
Leave a Reply