[20210324]bash shell value too great for base.txt
--//编写bash shell遇到的问题:
$ printf "%02x\n" $(( 08 +1 ))
-bash: 08: value too great for base (error token is "08")
--//前面有0实际上bash shell默认是八进制,这样0x8超过了8进制的表示范围,所以报错:shell value too great for base;
--//解决方案:
--//指定其为10进制即可,在结果前加上10#
$ printf "%02x\n" $(( 10#08 +1 ))
09
来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/267265/viewspace-2764610/ ,如需转载,请注明出处,否则将追究法律责任。