Check latest file updates in directory on linux using bash shell scripting Check latest file updates in directory on linux using bash shell scripting shell shell

Check latest file updates in directory on linux using bash shell scripting


You probably want the stat command. Do man stat to see how yours works. You want to look for "modtime" or "time of last data modification" option. For mine that would be stat -c%Y file. Something like basemodtime=$(stat -c%Y file) before the loop, modtime=$(stat -c%Y file) after func2(), and then if [ $modtime != $basemodtime ]; then to detect "updated".