Either use >>
as @Lajos Veres suggested, or watch on CLOSE_WRITE
event (that is IN_CLOSE_WRITE for Linux::Inotify2
module),
echo > /tmp/foo
inotifywait -m /tmp/foo
Setting up watches.
Watches established.
/tmp/foo MODIFY
/tmp/foo OPEN
/tmp/foo MODIFY
/tmp/foo CLOSE_WRITE,CLOSE