Skip to main content
3 of 7
Installation instruction for inotify-tools on Fedora

Simple, using inotifywait (install your distribution's inotify-tools package):

while inotifywait -e close_write; do ./; done

This has a big limitation: if some program replaces with a different file, rather than writing to the existing myfile, inotifywait will die. Most editors work that way.

To overcome this limitation, use inotifywait on the directory:

while true; do
  change=$(inotifywait -e close_write,moved_to,create .)
  change=${change#./ * }
  if [ "$change" = "" ]; then ./; fi