inotify-toolsand then you can wait for a file to change using:
inotifywait -m thefile.txt
-mflag monitors the file, instead of exiting on the first event. You can use
-eto wait for a particular event--see the man page.
inotifywait -m thefile.txt | while read file; do echo $file; done
filein this case will have the file name and event name, but you don't need to use it obviously.
bash bash-while inotifywait unix
Edit on Github!