Created
April 3, 2017 11:52
-
-
Save splattael/3de559c72f701248f5f5ba5eaeee10b7 to your computer and use it in GitHub Desktop.
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
#!/bin/bash | |
# Touches changed files in order to make it work | |
# on Docker and Windows. | |
# | |
# Usage: bin/touch_changed [<sleep every>] | |
EVERY=${1:-1} | |
RELOAD="tmp/reload" | |
DIRS="source" | |
# Initial touch | |
touch $RELOAD | |
find_changed() { | |
find $DIRS -type f -newer $RELOAD | |
} | |
while :; do | |
files=$(find_changed) | |
if [ "$files" != "" ]; then | |
echo "Changed: $files" | |
touch $RELOAD | |
touch -r $RELOAD $files | |
fi | |
sleep $EVERY | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment