Re: strange bash behavior
William Hopkins <we.hopkins@gmail.com> writes:
> On 09/03/13 at 03:45pm, Joe Pfeiffer wrote:
>> Stephen Powell <zlinuxman@wowway.com> writes:
>> >
>> > Interesting. If "break" appears out of context, you should get
>> > an error message something like:
>> >
>> > bash: break: only meaningful in a 'for', 'while', or 'until' loop
>> >
>> > You didn't get an error message, so part of bash thinks it is in context.
>> > Yet it did not exit the loop. It seems to me that you should get one
>> > behavior or the other. Either you should get an error message or it
>> > should exit the loop.
>>
>> Good point -- it is odd that it isn't giving the error message.
>
> The loop context is inherited by the subshell, so break thinks it is fine. It
> is only that it is totally meaningless to break there, since that signal cannot
> be captured by parent shell environment.
How is the context passed to the subshell? And what signal?
> This seems to be expected behavior..
Reply to: