# This is the file that will be monitored. MONITORED_FILE=~/frames.wf echo "echo kl.sh alive" # If any changes occur to this, then take appropriate action. # We will need this log to see whether any changes occured to /tmp/goreb.log TEMP_LOG=~/.frames.wf.log # This is a 1-time command i.e. create the log file if it does not exist. [ ! -f $TEMP_LOG ] && touch -r $MONITORED_FILE $TEMP_LOG while [ "$MONITORED_FILE" != "" ] do if [ $MONITORED_FILE -nt $TEMP_LOG ]; then echo "$MONITORED_FILE is newer than $TEMP_LOG. Reading it" touch -r $MONITORED_FILE $TEMP_LOG sleep 0.2 echo "readpath $MONITORED_FILE" fi MONITORED_FILE=`find $MONITORED_FILE -mmin -3 -type f` sleep 1 done echo "echo kl.sh stopped"