[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: "break" inside a while-condition
From: |
Chet Ramey |
Subject: |
Re: "break" inside a while-condition |
Date: |
Tue, 11 Sep 2012 18:43:46 -0400 |
User-agent: |
Mozilla/5.0 (Macintosh; Intel Mac OS X 10.6; rv:14.0) Gecko/20120713 Thunderbird/14.0 |
On 9/11/12 10:40 AM, Philippe Wang wrote:
> Bash Version: 4.2
> Patch Level: 0
> Release Status: release
>
> Description:
> "break" keyword inside a while-condition doesn't work as expected : it
> breaks the wrong loop.
>
>
> Repeat-By:
> # 1) should raise a parsing error (but it doesn't)
> while break ; true ; do true ; done
>
> # 2) should break the outer loop (but it doesn't)
> while true ; do while break ; do whatever-because-never-reached ; done ;
> echo fail ; done
No. Bash implements both of these correctly.
--
``The lyf so short, the craft so long to lerne.'' - Chaucer
``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, ITS, CWRU chet@case.edu http://cnswww.cns.cwru.edu/~chet/