trying hot reload script with inotifywait

This commit is contained in:
asus
2023-10-25 14:32:56 +02:00
parent d4c6607ce3
commit 86c3309acf
2 changed files with 46 additions and 29 deletions

20
build.sh Normal file
View File

@@ -0,0 +1,20 @@
#!/bin/bash
# Define the file to watch
file_to_watch="./"
## Watch for modification events on the file continuously
#inotifywait --monitor --event modify "$file_to_watch" | tee /dev/tty
#while read -r directory events filename; do
# echo "The file $filename was modified."
# # Add your desired actions here
#done
#inotifywait --monitor --event modify --format '%w %e %f' "$file_to_watch"
while read -r directory events filename; do
echo "The file $filename was modified."
# Add your desired actions here
done < <(inotifywait --monitor --event modify "$file_to_watch")