Created
March 23, 2016 16:04
-
-
Save ErwanAliasr1/1969b33d2c538a65d8ed 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 | |
pids="" | |
(sleep 10; exit 10) & pids="$pids $!" | |
(sleep 5; exit 5) & pids="$pids $!" | |
pids="$pids 9999" | |
for pid in $pids; do | |
wait $pid | |
echo "$pid returned $?" | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
erwan@R1:~$ LC_ALL=C ./p.sh
24102 returned 10
24103 returned 5
./p.sh: line 10: wait: pid 9999 is not a child of this shell
9999 returned 127