This is probably the most efficient way to block for changes on a file from a shell script. See 'inotifywait -help' for more info. I was originally thinking I'd put this up on sourceforge as a new project, but it's just too damn small.

If you don't specify which event you want to catch, all will be caught, and the event which occurred is output on stdout.

inotifywait will return true if an event you asked for is caught. If an event you didn't ask for is caught, it will return false; this generally occurs if you listen to a file on a particular partition, then unmount that partition, or if you listen for a specific event and the file is deleted before that event occurs, or something similar.

What's New in This Release:
Files can now be selectively excluded when watching directories recursively.
The list of files to watch or exclude can now be read in from a file.