#!/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")