Skip to content

Instantly share code, notes, and snippets.

@gammy
Created May 21, 2015 10:04
Show Gist options
  • Select an option

  • Save gammy/3e4bfa93a941e5be80df to your computer and use it in GitHub Desktop.

Select an option

Save gammy/3e4bfa93a941e5be80df to your computer and use it in GitHub Desktop.
filename="foo"
sample_period=5s;
old_size=$(stat --format="%s" "$filename")
sleep "$sample_period"
new_size=$(stat --format="%s" "$filename")
if [ "$new_size" -ne "$old_size" ]; then
echo "Changed"
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment