Re: Bug in function return statement in while subshell
From:
Greg Wooledge
Subject:
Re: Bug in function return statement in while subshell
Date:
Mon, 29 Jul 2013 11:44:53 -0400
User-agent:
Mutt/1.4.2.3i
On Mon, Jul 29, 2013 at 06:36:58PM +0300, Pierre Gaston wrote:
> it's not clear (like it is for, say, exit) what the relationship
> between return and process is.
> I guess most people expect it to not care about subshells and just
> execute the statement after the function call.
"Most people" barely know what a subshell is.
> I'm not sure how the case foo () { return & echo foo; } would fit though.
My personal opinion is that this is horrible code and you should be
ashamed of it, if you wrote it. The return is executed in a background
job, so it does nothing except cause immediate termination of the job.
I don't see any compelling argument to change the way Bash handles this.