On Fri, Aug 18, 2017 at 6:22 PM, vanou <v...@star.ocn.ne.jp> wrote:
> Hello, > > I think, there is document bug related to 'for' compound command in both > Man page and Info doc. > > > In man page, description of 'for' compound command ... > > ************************************************************ > **************************************** > * for (( expr1 ; expr2 ; expr3 )) ; do list ; done > * First, the arithmetic expression expr1 is evaluated according > * to the rules described below under ARITHMETIC EVALUATION. > * The arithmetic expression expr2 is then evaluated repeatedly > * until it evaluates to zero. > <-- not zero, but 1 > * Each time expr2 evaluates to a non-zero value, > <-- not non-zero,but 0 > * list is executed and the arithmetic expression expr3 is evaluated. > * If any expression is omitted, it behaves as if it evaluates to 1. > <-- not 1, but 0 > * The return value is the exit status of the last command in list > * that is executed, or false if any of the expressions is invalid. > ************************************************************ > **************************************** > > > And same document bug in Info documentation of bash. > > This bug is seen at bash 4.4. > > Thanks, > Vanou > > > The documentation seems ok, what makes you think the contrary? eg for ((;0;)); do echo foo;done # prints nothing for ((;1;)); do echo foo;done # is infinte for ((;;)); do echo foo;done # is also infinite