Created
March 29, 2020 22:26
-
-
Save kevboutin/017444a993633c757e602f3c8b660bf1 to your computer and use it in GitHub Desktop.
This demonstrates how a bash script can invoke a child process to do some work asynchronously and monitor for finish
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 | |
mycommand & | |
child_pid=$! | |
while kill -0 $child_pid >/dev/null 2>&1; do | |
echo "Child process is still running" | |
sleep 1 | |
done | |
echo "Child process has finished" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment