Freek de Kruijf writes:
> Indeed the && before continue should have acted as ; I did not realize up
> could return a status 1 and not execute continue. Inserting "return 0" at the
> end of up solves the problem.
It seems to me that it would be a better solution to replace "up &&
continue" with
Op donderdag 22 oktober 2020 04:11:10 CEST schreef Dale R. Worley:
> r...@beelaertsict.nl writes:
> > #!/bin/bash
> > # test error in while clause
> > #
> > set -x
> > up () {
> >
> > i=$(($i+1))
> > [ $i -eq 5 ] && j=$(($j+1)) && i=0
> >
> > }
> > i=0
> > j=0
> > # while loop should end
r...@beelaertsict.nl writes:
> #!/bin/bash
> # test error in while clause
> #
> set -x
> up () {
> i=$(($i+1))
> [ $i -eq 5 ] && j=$(($j+1)) && i=0
> }
> i=0
> j=0
> # while loop should end when i=4 and j=2
> while [ $i -ne 4 -o $j -ne 2 ]
> do
> if [ $i -eq 3 ]
> then
> up &&
On Wed, Oct 21, 2020 at 04:48:39PM +0200, r...@beelaertsict.nl wrote:
> #!/bin/bash
> # test error in while clause
> #
> set -x
> up () {
> i=$(($i+1))
> [ $i -eq 5 ] && j=$(($j+1)) && i=0
> }
> while [ $i -ne 4 -o $j -ne 2 ]
> do
> if [ $i -eq 3 ]
> then
> up && continue
If