Causes and solutions: "value too great for base 08" of

Today debug shell when suddenly a problem, have not been found before

08 :value too great for base

<pre name="code" class="plain" style="margin: 4px 0px; background-color: rgb(240, 240, 240);">if [ $(($(date "+%M")%5)) -eq $((0)) ];then
echo 111
fi

 
 
Finally tracking problems found in time is 08 minutes and 09 minutes, will face this problem, access to information
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("%02d") 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.

Have fun,
Stuart.

The original post address: http: //www.google.com/search client = safari & rls = zh-cn & q = value + too + great + for + base & ie = UTF-8 & oe = UTF-8?

Solution, an increase of 10 # is defined as a decimal to ok

<pre name="code" class="plain" style="margin: 4px 0px; background-color: rgb(240, 240, 240);">if [ $((10#$(date "+%M")%5)) -eq $((0)) ];then
echo 111
fi

 
 
Published 27 original articles · won praise 53 · views 160 000 +

Guess you like

Origin blog.csdn.net/auspi12341/article/details/52288967