Right now, I have a script that runs daily that chmod's the home directories, removing all "other" permissions from the directories and the "group" write permission. See below.
#Removing all other permissions on all home directories and write from group ls /home | sed 's/ //g' | while read i; do chmod -R o-rwx /home/$i chmod -R g-w /home/$i done
This works great; however, I would prefer if the script checked if there were any files that needed to be changed and then act upon them instead of just doing it every time, regardless if it needs it.
I assume I could put this whole thing in a sub function inside of a
if statement, but I don't know what test I would run inside that
How can I test if the directories would need changed?