I have a script that writes to a named pipe and another that reads from the pipe. Occasionally, when starting the script I have noticed that the contents of the pipe exist
Try this:
"Opening the FD read/write rather than read-only when setting up the pipeline prevents blocking."
from:
Setting up pipelines reading from named pipes without blocking in bash