Last active
January 29, 2019 16:26
-
-
Save pfeilbr/715f8da53450726c4c663eac83e4c096 to your computer and use it in GitHub Desktop.
example of getting file change details along with a batch marker. fswatch
This file contains hidden or 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
# example of getting file change details along with a batch marker | |
# used to perform single action for "batch" for file changes | |
# set to `true` to echo all file changes | |
DEBUG=false | |
FILE_CHANGE_BATCH_MARKER='--file-change-batch-end--' | |
fswatch --batch-marker="${FILE_CHANGE_BATCH_MARKER}" -0 . | xargs -0 -n 1 -I {} echo {} | while read file_path; | |
do | |
if $DEBUG; then | |
echo $file_path; | |
fi | |
# run block if file change batch marker is output | |
if [ "$file_path" = "$FILE_CHANGE_BATCH_MARKER" ]; then | |
echo $file_path; | |
fi | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment