t; + up
> + i=5
> + '[' 5 -eq 5 ']'
> + j=3
> + i=0
> + echo At bottom i=0 j=3
> At bottom i=0 j=3
>
> This makes it clear what is happening: when i == 3, the "if" is entered
> and the "up" is executed. But the "up" returns status 1, and so the
> "continue" is not executed. Execution continues in the block to the
> second "up", which increments i and then rolls over to increment j. The
> exit condition is never met.
>
> Dale
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.
Many thanks for the lesson.
--
fr.gr.
Freek de Kruijf
teaching me this concept. It must have some meaning in more
complicated situations.
A test -n "$1" has also the effect I was looking for as the suggested one
$# -ne 0 .
--
fr.gr.
Freek de Kruijf