I'm doing a directory-monitoring project. I'd to write a bash script that will calculate the md5checksum of a directory, and store that variable for later comparison. This script will have to run by cronjob and will execute a command if said variable doesn't match the earlier set one.
When I run
echo -n /path/to/directory | md5sum
I'm certain that it is only calculating the md5 of the string "/path/to/directory", and not the directory itself.
Is this possible? If so, how do I then store that variable for later comparison by the next instance of the script?