Created
November 21, 2011 14:41
-
-
Save ramn/1382793 to your computer and use it in GitHub Desktop.
autocompile: inotifywait loop that autocompiles using given command and file pattern
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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