Skip to content

Instantly share code, notes, and snippets.

@renfredxh
Created September 13, 2014 04:36
Show Gist options
  • Save renfredxh/b06c09158e2d07c4a220 to your computer and use it in GitHub Desktop.
Save renfredxh/b06c09158e2d07c4a220 to your computer and use it in GitHub Desktop.
Watch directory and evaluate command
#!/bin/bash
path="../grails-app"
command="grails compile"
chsum1=""
echo "Watching ${path} for changes"
while [[ true ]]
do
chsum2=`find ${path} -type f -exec md5sum {} \;`
if [[ $chsum1 != $chsum2 ]] ; then
date +"[%T] Running ${command}"
eval "grails compile"
chsum1=$chsum2
fi
sleep 2
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment