Last active
April 10, 2020 15:31
-
-
Save NatalieWolfe/39c9aaa95c599434646c9ff9c5d17816 to your computer and use it in GitHub Desktop.
Script to watch a directory for changes.
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 | |
# Usage: ./watch.sh watch_id path_to_watch | |
touch "/tmp/watch_${1}_1" | |
ls -x > "/tmp/watch_${1}_2" | |
cat "/tmp/watch_${1}_1" "/tmp/watch_${1}_2" | sort | uniq | |
mv "/tmp/watch_${1}_2" "/tmp/watch_${1}_1" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Nice. That is much better. :)