[Top][All Lists]

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

Re: "until continue" causes bash to exit.

From: konsolebox
Subject: Re: "until continue" causes bash to exit.
Date: Wed, 20 Jul 2016 09:54:05 +0800

On Wed, Jul 20, 2016 at 7:15 AM, Dan Douglas <address@hidden> wrote:
> Hi, I could reproduce this in all bash versions.
> bash -c 'set -x; until continue; do :; done; echo test1'; echo test2
> + continue
> test2
> I'm not actually sure whether this is supposed to work at all. Almost
> all shells do something strange when given continue in the first
> compound-list. E.g. ksh93 does like bash and exits, and zsh breaks
> out of the loop.

I see nothing wrong using continue before `do`.   I've used it a lot
of times and I never had issues with it.  It is useful when trying to
imitate `do {} until ...`, or `do {} while ...`.

However, I won't mind if it just skips checking `$?` when an explicit
control command like `continue` is used since it's more sensible that
way.  Currently, `continue` is just synonymous to `break` when used in
an `until` loop, and I find that counter-intuitive.  Four others
shells don't behave that way.


reply via email to

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