Created
November 28, 2016 05:46
-
-
Save adis-io/9aa62bef2832c4bebb6591af2d5813e1 to your computer and use it in GitHub Desktop.
This file contains 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 | |
items="1 2 3 4 5 6" | |
pids="" | |
for item in $items; do | |
sleep $item & | |
pids+="$! " | |
done | |
for pid in $pids; do | |
wait $pid | |
if [ $? -eq 0 ]; then | |
echo "SUCCESS - Job $pid exited with a status of $?" | |
else | |
echo "FAILED - Job $pid exited with a status of $?" | |
fi | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment