Timeline for Collect exit codes of parallel background processes (sub shells)
Current License: CC BY-SA 3.0
12 events
| when toggle format | what | by | license | comment | |
|---|---|---|---|---|---|
| Apr 11, 2018 at 12:41 | comment | added | Alexander Mills | I think @argberg's answer is better now, I may delete this answer soon | |
| Mar 29, 2018 at 6:54 | comment | added | Scott - Слава Україні | Can you explain how and why you believe the version with the trap is better than the one without it? (I believe that it’s no better, and therefore that it is worse, because it is more complex with no benefit.) | |
| Feb 18, 2017 at 22:41 | vote | accept | Alexander Mills | ||
| Apr 11, 2018 at 12:33 | |||||
| Feb 18, 2017 at 22:40 | history | edited | Alexander Mills | CC BY-SA 3.0 |
added 204 characters in body
|
| Feb 13, 2017 at 9:39 | history | edited | Alexander Mills | CC BY-SA 3.0 |
use trap to get exit code of sub shells
|
| Feb 13, 2017 at 9:37 | comment | added | Alexander Mills | thanks @Chunko, trap works better, you're right. With wait <pid>, I got fallthrough. | |
| Feb 12, 2017 at 20:40 | history | edited | Alexander Mills | CC BY-SA 3.0 |
added 16 characters in body
|
| Feb 12, 2017 at 20:04 | comment | added | Alexander Mills | @Chunko thanks! that is good info, could you maybe update the answer with something you think is best? | |
| Feb 12, 2017 at 13:52 | comment | added | Chunko | Also "wait -n" will wait for any child and then return the exit status of that child in the $? variable. So you can print progress as each one exits. However note that unless you use the CHLD trap, you may miss some child exits that way. | |
| Feb 12, 2017 at 13:42 | comment | added | Chunko | You can also use SIGCHLD trap to process the children when they exit, such as printing out the status at that time. Or updating a progress counter: declare a function then use "trap function_name CHLD" though that may also require an option to be turned on in a non-interactive shell, such as possibly "set -m" | |
| Feb 12, 2017 at 12:28 | history | edited | Alexander Mills | CC BY-SA 3.0 |
deleted 70 characters in body
|
| Feb 12, 2017 at 11:23 | history | answered | Alexander Mills | CC BY-SA 3.0 |