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"
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"