This script works as it should:
#!/bin/bash
sleep 9 &
wait
echo "ok"
Return "OK" after aprox. 9 seconds.
But this one:
#!/bin/bash
echo "1" | while read in
do
sleep 9 &
done
wait
echo "ok"
Return "OK" immediately. What's wrong, why we didn't wait for background task? What is my error or misunderstanding?