That still has some_other_command never getting executed, so I think just 
adding the printf sufficient.
On Wednesday, July 8, 2020 Nick Stoughton <nickstough...@gmail.com> wrote:
The whole point of this example is to show that the exit status *of the while 
loop* will be zero if the loop does not execute, and if you care about exit 
statuses of commands in the first compound-list (the one that is being tested), 
you must store them as you evaluate that condition.
Possibly it would be helpful to show more by extending the example to something 
like:    while some_command; st=$?; false; do some_other_command; done; printf 
"while loop status: %d; some_command status: %d\n" $? $st
If folks agree that this would help I will file a Mantis bug for you.-- Nick
On Wed, Jul 8, 2020 at 2:55 AM Wilhelm Mueller <mu...@acm.org> wrote:

I can't log in with the bug tracker, so I'll try to send this directly
to the list.

Section 2.9.4.5
Page 2302

To retain the final status of "compunt-list-1", the note gives the
following example:

Line 74477
        while some_command; st=$?; false; do ...

This will retain the status, but with 'false' always failing by
definition, the loop will never be run.

My suggestion is to replace it by the following:

        while some_command; st=$?; [ $st -eq 0 ]; do ...

Yours,
Wilhelm

-- 

 **************************************** fixed pitch fonts! **
  Wilhelm Müller          mu...@gmx.net             (o_
                                          (o_  (o_  //\
  1024D/2048g  5E6E CF83 B15E C7ED 1A31   (/)_ (/)_ V_/_
   F9435BF6    E9F3 F509 FD7B F943 5BF6             © N.Smith


Reply via email to