Waiting for process
Until now, I did the following to wait for a process:
$ wait $pid
The above does only work for child processes (stared by the same shell). The hack works for any processes:
$ tail --pid=$pid -f /dev/null
Learned from to StackOverflow answer.