On 6/18/23 16:28, Rob Landley wrote: > On 6/12/23 19:40, Chet Ramey wrote: >> I wish you were not so reluctant. Look at how many things you've discovered >> that I decided were bugs based on our discussions. > > But since you asked, today's new question I wrestled with was
What happens when you return from a subshell: $ x() { (echo hello; return); echo two; }; x; echo three hello two three $ x() { (echo hello; return); echo two; return;}; x; echo three hello two three $ x() { (echo hello; return; echo next); echo two; return;}; x; echo three hello two three $ (echo one; return;); echo two one bash: return: can only `return' from a function or sourced script two So in a function, return ends a parenthetical subshell (without error) and continues on within the function after the parenthetical (and you can return a second time from the same function because the first didn't count), but return will NOT end a parenthetical (without error) outside of a function call. Rob _______________________________________________ Toybox mailing list Toybox@lists.landley.net http://lists.landley.net/listinfo.cgi/toybox-landley.net