help-bash
[Top][All Lists]
Advanced

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

Re: [Help-bash] subtle "break" strangeness


From: Chris Down
Subject: Re: [Help-bash] subtle "break" strangeness
Date: Tue, 3 Sep 2013 17:06:55 +0200
User-agent: Mutt/1.5.21 (2010-09-15)

On 2013-09-03 11:03, Greg Wooledge wrote:
> Obviously you can't just say "if the current process is a subshell,
> then issue a warning if break is used".  Because the entire loop might
> be in a subshell, and then break would just act as expected.

Which is why that's not even close to what I said.

> Are you proposing that bash should keep track of the "subshell depth"
> at all times, and also keep track of what the subshell depth was each
> time a loop was created, so that when 'break' is called, it can compare
> the current depth to the depth of the loop it's trying to break out of?

I'm suggesting that after forking, the child should not maintain loop/function
context, unless it is a function definition in itself -- for example:

    foo() ( bar )

Attachment: pgpT8CPjxSdKF.pgp
Description: PGP signature


reply via email to

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