bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Document bug of 'for' compound command


From: DJ Mills
Subject: Re: Document bug of 'for' compound command
Date: Fri, 18 Aug 2017 12:12:12 -0400

It's an arithmetic expression, 1 is true and 0 is false. This is not the
same as the exit status of a command

On Fri, Aug 18, 2017 at 11:59 AM, Pierre Gaston <pierre.gaston@gmail.com>
wrote:

> On Fri, Aug 18, 2017 at 6:22 PM, vanou <van@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
>


reply via email to

[Prev in Thread] Current Thread [Next in Thread]