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
kill -s 0 $pid will return success if $pid is running, failure otherwise, without actually sending a signal to the process, so you can use that in your if statement directly.
kill -s 0 $pid
$pid
if
wait $pid will wait on that process, replacing your whole loop.
wait $pid