Created
December 16, 2017 23:09
-
-
Save shanewholloway/16c121bc4af7cba04670492445df3b4f to your computer and use it in GitHub Desktop.
POSIX join jobs "reduce"
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
FAIL=0 | |
for job_pid in `jobs -p`; do | |
echo "Joining job $job_pid" | |
wait $job_pid || let "FAIL+=1" | |
done | |
if [[ "$FAIL" != "0" ]]; then | |
echo Failed join processes $FAIL | |
exit 1 | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment