Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
This demonstrates how a bash script can invoke a child process to do some work asynchronously and monitor for finish
#!/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