SHELL中數值進制轉換
八進制(020)→10
[[email protected] yemo]# echo $((num=020)) 16 [[email protected] yemo]# echo $((num=8#20)) 16
十六進制(0xff)→10
[[email protected] yemo]# echo $((num=0xff)) 255 [[email protected] yemo]# echo $((num=16#ff)) 255 [[email protected] yemo]# echo $((num=2#1111111)) 127 [[email protected]
十進制→其他
[[email protected] yemo]# echo "obase=2;338"|bc 101010010 [[email protected] yemo]# echo "obase=8;338"|bc 522 [[email protected] yemo]# echo "obase=16;338"|bc 152
本文出自 “庭前夜末空看雪” 博客,請務必保留此出處http://12550795.blog.51cto.com/12540795/1958364
SHELL中數值進制轉換