Using a shell script, can I watch a folder and block program execution until a file in a certain folder changes?

  • testfactor@lemmy.world
    link
    fedilink
    English
    arrow-up
    2
    ·
    21 hours ago

    Even if you wanted to implement a solution like this, which you shouldn’t, why on earth monitor the MD5 sum instead of just the mtime of the file??? Like, doing a checksum is the least efficient method of checking this possible.

    Like, you could do a simple while loop with a find myfile.txt +mmin 1; sleep 30 in it. Adjust numbers to your desired tolerance.

    Again, don’t do that. But if you must, definitely don’t do an md5sum for godssake.