I stumbled over a curious bug, I think:
I tried to read \"512\" as a number to base 6, and output it as base 16:
echo \"ibase=6;obase=16;512\" | bc
161
Slightly modify the code (two ways) and your expected results appear:
for ib in {6,8,10,16}; do
echo $ib; for ob in {10,16}; do
echo -en $ib $ob" \t => " ;
ob=`echo "obase=$ib;$ob" | bc`
echo "ibase=$ib;obase=$ob;333" | bc ;
done;
done;
for ib in {6,8,10,16}; do
echo $ib; for ob in {10,16}; do
echo -en $ib $ob" \t => " ;
echo "obase=$ob;ibase=$ib;333" | bc ;
done;
done;
execute in bash sandbox
results for both ways are:
6
6 10 => 129
6 16 => 81
8
8 10 => 219
8 16 => DB
10
10 10 => 333
10 16 => 14D
16
16 10 => 819
16 16 => 333