How to ensure a process has started reading a file before continuing?

view full story

http://unix.stackexchange.com – I'm trying to write a command to test that data is written to a file. My first approach was: Start reading in the background. Write some data to the file. Wait for the reader to find a result. Repeat indefinitely to see if there's a timing issue. In script form: while true do grep -q foo <(tail -n0 -f /var/log/syslog) & logger foo && logger line && wait done (the logger line command is to avoid last message repeated N times lines in the file) This version will typically loop a once or twice before getting stuck at the wait command, so it looks like tail d (HowTos)