.html 原因:以下是代码片段:
Numbers starting with leading 0 are Octal numbers (base 8) in many programming
languages including C, Perl and shell. Valid octal digits are
0,1,2,3,4,5,6,7 so it barfs if it sees an 8 or a 9. You probably want
to work in straight numbers and make a leading 0 in your output
format with a sprintf("d") kind of formatting thing.
Anything starting with 0x or 0X is a hex number.
So the error message means exactly as it says- it's an error from
the let function complaining about the value being too big for the base.
上面就是说以0开头的被默认为八进制了,所以08就是无效的八进制数喽,呵呵
解决方案:以下是代码片段:
You can explicitly state the base of a number using base#number
Code:
if [ $((10#$item)) -eq 0 ] ; then
That will have trouble if the number starts with a minus sign.
The '-' needs to be in front of the base like -10#009 for -9.
上面就是说解决方法可以用 进制#变量 来转换,如08 改成10进制 10#08 或 10#$var ,
还有就是关于负号 - 要放在前面 -10#08