themactep.com

A home of miscellaneous projects by Paul Philippov.

Notes

How to convert between number systems using bc in shell

obase - target system, ibase - source system

echo 'obase=2; ibase=10; 365' | bc
>> 101101101
echo 'obase=10; ibase=2; 1010011010' | bc
>> 666
echo 'obase=8; ibase=10; 255' | bc
>> 377
echo 'obase=16; ibase=10; 255' | bc
>> FF