Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: Bug with continue?



> On 28/03/2023 12:28 Peter Stephenson <p.w.stephenson@xxxxxxxxxxxx> wrote:
> > On 28/03/2023 11:17 Peter Stephenson <p.w.stephenson@xxxxxxxxxxxx> wrote:
> > > On 28/03/2023 10:32 Felipe Contreras <felipe.contreras@xxxxxxxxx> wrote:
> > > I notice this works differently in zsh than in other shells:
> > > 
> > >   for x in 1 2 3 4; do
> > >     continue &&
> > >     list="$list$x " &&
> > >     echo "x: $x"
> > >   done
> > >   echo "list: $list"
> > > 
> > > Why did the statement after `continue` gets evaluated?
>
> This one is a little weird as if the immediately next statement is a
> print it doesn't get executed.

For what it's worth, I suspect this difference is because the
assignment is going through execsimple() rather than the execcmd_...
series.  As it's name suggests execsimple() doesn't do a lot of testing.

I'd rather not tinker with that; the fix we have should be good enough.

pws




Messages sorted by: Reverse Date, Date, Thread, Author