I am working with the following block of bash and it is not printing out the first line of expected output:
exec 3< <(python3 -m http.server) while true; do read -t 2 line echo "reading..." echo "$line" done <&3
python3 -m http.server starts, it prints out a line
Serving HTTP on 0.0.0.0 port 8000, but the code above does not print that line. Afterwards, python will print things like GET requests as they occur and those are printed. Why is bash missing this first line?
My goal is to put this in a script and replace the
echo calls with a test for the redirected process indicating that it has finished starting up and then to break the loop and end the script (so block execution of the script until start up is done), with the redirected process continuing in the background.
http.server is just my test case.