八进制(020)→10
[root@localhostyemo]#echo$((num=020)) 16 [root@localhostyemo]#echo$((num=8#20)) 16
十六进制(0xff)→10
[root@localhostyemo]#echo$((num=0xff)) 255 [root@localhostyemo]#echo$((num=16#ff)) 255 [root@localhostyemo]#echo$((num=2#1111111)) 127 [root@localhostyemo]#echo$((num=2#11111111)) 255
十进制→其他
[root@localhostyemo]#echo"obase=2;338"|bc 101010010 [root@localhostyemo]#echo"obase=8;338"|bc 522 [root@localhostyemo]#echo"obase=16;338"|bc 152原文链接:https://www.f2er.com/bash/391268.html