Reopen voters: flock() doesn't work on named pipes, this is not a dupe.
I was trying to do the following with named pipes:
mkfifo example.txt
( printf "456"; printf "abc"; printf "\n"; ) > example.txt &
( printf "456"; printf "abc"; printf "\n"; ) > example.txt &
( printf "456"; printf "abc"; printf "\n"; ) > example.txt &
If I cat the example.txt sometimes I got:
456abc
456abc
456abc
Other times I got:
456456456abcabc
abc
I was hoping the writes would be atomic. Is there any way to achieve atomic writes?