env import: clean up bracket count code
When importing an exported shell function, the bracket count code didn't handle negative return value from _bracket_cnt(), so a shell function (or a shell variable starting with '(') would loop until the end of the env output. Since the test for no open bracket wasn't handled anyway, remove this and clean up _bracket_cnt() code (which now returns negative if there are more closing than opening brackets). Also, remove the unneded local integer bracket_cnt from the while loops and only continue processing while the bracket tally is > 0. Note: There are still many unhandled corner cases in this code.
Please register or sign in to comment