$! is a special variable in bash that holds the process ID of the last background command.

wait $! waits for the last background command to finish.

sleep 5 &
wait $!
echo "Done"