Created
March 9, 2018 00:23
-
-
Save tomsaleeba/ac3332e8f4c147a51a60cf2bbecef3f1 to your computer and use it in GitHub Desktop.
BASH wait command demo
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
#!/usr/bin/env bash | |
# short demo on how to wait for multiple jobs | |
echo 'start' | |
sleep 2 & | |
job1=$! | |
echo "do things that don't require job 1 output" | |
sleep 4 & | |
job2=$! | |
echo "do things that don't require job 2 output" | |
wait $job1 | |
echo 'do things that depend on job 1' | |
wait $job2 | |
echo 'do things that depend on job 1 AND job 2' | |
echo 'end' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment