Created
September 22, 2022 22:15
-
-
Save Donluigimx/2bca64fb01f55b03250bac64261ab14e to your computer and use it in GitHub Desktop.
Watch for changes on a folder, execute command on change
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
| daemon() { | |
| chsum1="" | |
| while [[ true ]] | |
| do | |
| chsum2=`find src/ -type f -exec md5 {} \;` | |
| if [[ $chsum1 != $chsum2 ]] ; then | |
| if [ -n "$chsum1" ]; then | |
| execute | |
| fi | |
| chsum1=$chsum2 | |
| fi | |
| sleep 2 | |
| done | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment