On Fri, Jul 21, 2023 at 01:15:16PM +0200, alex xmb ratchev wrote:
> On Thu, Jul 20, 2023, 8:09 PM Greg Wooledge <greg@wooledge.org> wrote:
> > On Fri, Jul 21, 2023 at 12:33:07AM +1000, Martin D Kealey wrote:
[...]
> > Well in any case, the behavior you wanted is not reliable across shells,
> > nor even across versions of bash.
> >
>
> me ?
I was replying to Martin Kealey. "You" in that sentence referred to him.
> i dont have interest in supporting not newest versions ... 4.4 ? uh
> not my case , nor would i support it
The "non-local break/continue" that Martin wanted doesn't work in 5.2
either.
> > unicorn:~$ bash-4.4 foo
> > 1
> > f
> > foo: line 1: break: only meaningful in a `for', `while', or `until' loop
> > 2
> > f
> > foo: line 1: break: only meaningful in a `for', `while', or `until' loop
> > 3
> > f
> > foo: line 1: break: only meaningful in a `for', `while', or `until' loop
unicorn:~$ bash-5.2 foo
1
f
foo: line 1: break: only meaningful in a `for', `while', or `until' loop
2
f
foo: line 1: break: only meaningful in a `for', `while', or `until' loop
3
f
foo: line 1: break: only meaningful in a `for', `while', or `until' loop
I used 4.3 and 4.4 in my demonstration because that was where the
behavior changed. Everything *before* 4.3 presumably works like 4.3,
and everything *after* 4.4 presumably works like 4.4, though I didn't
test all the versions. Only a tiny handful.
I showed exactly how I ran my demonstration, so you could have repeated
it using your own bash version to see whether it supported the non-local
break/continue.
But I guess now you don't have to, since I just did it for you.