Bases


Convert between numerical bases with #bash and #bc

#!/bin/bash
num=$1
from=$2
to=$3
dec=$(echo "ibase=$from; $num" | bc)
conv=$(echo "obase=$to; $dec" | bc)
echo "$conv"


Unknown's avatar

About Linuxgal

Need a spiritual home? Consider joining us at Mary Queen of the Universe Latter-day Buddhislamic Free Will Christian UFO Synagogue of Vishnu
This entry was posted in Uncategorized. Bookmark the permalink.

Leave a Reply