bug-bash
[Top][All Lists]
Advanced

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

Re: "until continue" causes bash to exit.


From: Chet Ramey
Subject: Re: "until continue" causes bash to exit.
Date: Tue, 19 Jul 2016 22:45:36 -0400
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.11; rv:45.0) Gecko/20100101 Thunderbird/45.2.0

On 7/19/16 7:15 PM, Dan Douglas 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.

It should probably print `test1', and I'll change bash to make it do that.
`continue' just sets a flag saying how many loop levels to break, but
it doesn't get reset if the loop test causes the loop to break.  I imagine
ksh93 does the same thing.  dash and mksh go into an infinite loop.

Chet
-- 
``The lyf so short, the craft so long to lerne.'' - Chaucer
                 ``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, UTech, CWRU    chet@case.edu    http://cnswww.cns.cwru.edu/~chet/

Attachment: signature.asc
Description: OpenPGP digital signature


reply via email to

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