Skip to content

Instantly share code, notes, and snippets.

@ramn
Created November 21, 2011 14:41
Show Gist options
  • Save ramn/1382793 to your computer and use it in GitHub Desktop.
Save ramn/1382793 to your computer and use it in GitHub Desktop.
autocompile: inotifywait loop that autocompiles using given command and file pattern
if [ -z $1 ] || [ -z $2 ]
then
echo "Usage: autocompile <compiler-command> <pattern>"
echo "Examaple: autocompile fsc *.scala"
exit
fi
while true
do
inotifywait -q -e modify,attrib --format='%w' --fromfile <( find . -iname "$2") | while read FILE
do
echo Compiling file: $FILE
$1 $FILE
done
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment