| Summary: | ash return in function exits shell instead of function | ||
|---|---|---|---|
| Product: | Busybox | Reporter: | Anthony Best <anthonybest> |
| Component: | Other | Assignee: | unassigned |
| Status: | RESOLVED INVALID | ||
| Severity: | major | CC: | busybox-cvs |
| Priority: | P5 | ||
| Version: | 1.21.x | ||
| Target Milestone: | --- | ||
| Hardware: | All | ||
| OS: | Linux | ||
| Host: | Target: | ||
| Build: | |||
| Attachments: | return exits shell | ||
bash 3.x and 4.x works the same. "return" with no exitcode uses exitcode of the last command, in this case "false" sets exitcode to 1. with -e, such return qualifies as failing command, and it makes shell exit. |
Created attachment 6541 [details] return exits shell When return is the first command in the else block inside of a function the shell exits. It does not exit if return is the second command. This only seems to happen if the -e flag is set. See attachment for test case. If you make this change, it starts working again: if false ; then echo "false" else echo "anything" return fi