Is there any way of setting up a simple bash script such as
chmod a+xr -R ~/lib/
but in a way such that this script is run automatically when any file is created or moved to inside the lib directory, and directories nested within lib?
Sort of like waiting for some event to happen, triggering execution of the script - that's the information I'm looking for.
. . . major Unix versions have event framework extensions to the traditional Posix core services.
If you are taking about Linux, see dnotify and the later facility, inotify.
These facilities don't really have much to do with bash, but dnotify is oriented to run scripts. These features are probably already in your kernel, but you most likely will need to install a package such as inotify-tools in order to easily access them.
The BSD systems and other Unix-proper systems have equivalent mechanisms.