Using a shell script, can I watch a folder and block program execution until a file in a certain folder changes?
You must log in or # to comment.
Can continuously loop over the file, examine the md5 hash for changes.
Run the script if it has changed.
https://stackoverflow.com/questions/6475252/bash-script-watch-folder-execute-command
daemon() { chsum1="" while [[ true ]] do chsum2=`find src/ -type f -exec md5 {} \;` if [[ $chsum1 != $chsum2 ]] ; then if [ -n "$chsum1" ]; then compile fi chsum1=$chsum2 fi sleep 2 done }Oh god please don’t do this. Constantly reading the file is just stressing your IO for no reason.
Please inotify instead:
I really like this, replace compile with whatever command you desire I guess.
This is a terrible solution. You will stress your IO for no reason.

