Hi Everyone,
I'm working on CentOS 7, x86_64, fully patched. The server has a
manual wiki installation. Ownership and permissions need to be set
after an update. I've got a script that does it. The slowest part of
the script is this:
# Make Python, PHP and friends executable
IFS= find "$WIKI_DIR" -type f -print | while read -r file
do
if file -b "${file}" | grep -q -E 'executable|script';
then
chmod u=rwx,g=rx,o= "${file}"
else
chmod u=rw,g=r,o= "${file}"
fi
done
Some of the files have whitespace in their names so I need something
like 'find -print | while read'.
When I added the 'file -b' piped to 'grep -E' the script slowed down
considerably.
Is there any way to speed up that portion of the script?
Thanks in advance.
Jeff