I want to stall the execution of my BASH script until a process is closed (I have the PID stored in a variable). I\'m thinking
while [PID IS RUNNING]; do sleep 5
It seems like you want
wait $pid
which will return when $pid finishes.
$pid
Otherwise you can use
ps -p $pid
to check if the process is still alive (this is more effective than kill -0 $pid because it will work even if you don't own the pid).
kill -0 $pid