Skip to content

Instantly share code, notes, and snippets.

@tarmstrong
Created November 15, 2013 20:41
Show Gist options
  • Save tarmstrong/7491208 to your computer and use it in GitHub Desktop.
Save tarmstrong/7491208 to your computer and use it in GitHub Desktop.
#!/usr/bin/env bash
while [ 1 ];
do
cp ~/test.txt ~/test.txt.old
EVENT=$(inotifywait --format '%e' ~/test.txt);
[ $? != 0 ] && exit
[ "$EVENT" = "MODIFY" ] && echo 'file modified!'
diff ~/test.txt ~/test.txt.old
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment