Created
September 9, 2024 21:25
-
-
Save sparr/498479a91a1a317a47b035e16f1c328c to your computer and use it in GitHub Desktop.
Bash script: Wait for one process to exit
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 | |
# | |
# This script launches two processes and exits when either of them exits | |
( | |
do_thing_1 | |
kill -s SIGHUP $$ | |
) & | |
( | |
do_thing_2 | |
kill -s SIGHUP $$ | |
) & | |
# wait for one of the processes to exit and send a SIGHUP back to this shell | |
sleep infinity |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment