Skip to content

Instantly share code, notes, and snippets.

@bamboo
Created March 5, 2014 17:51
Show Gist options
  • Save bamboo/9372556 to your computer and use it in GitHub Desktop.
Save bamboo/9372556 to your computer and use it in GitHub Desktop.
#! /bin/bash
# adapted from http://stackoverflow.com/questions/4060212/in-linux-how-do-i-run-a-shell-script-when-a-file-or-directory-changes/20381373#20381373
DIRECTORY_TO_OBSERVE="src"
BUILD_SCRIPT=./gradlew
function block_for_change {
inotifywait -r \
-e modify,move,create,delete \
--exclude ".*/build/.*" \
$DIRECTORY_TO_OBSERVE
}
function build {
bash $BUILD_SCRIPT
}
build
while block_for_change; do
build
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment