I have the need to chmod files which are in a certain group. I have come up with this construct:find . -group groupname -exec sh -c 'su -c chmod -R u+w,g-w,o-w,g+r,o+r . - groupname {}' \;This works, but fails when the filename has a bracket ( or ) in it.Any ideas?
chmod files with group - error on files with (
find;quoting;filenames
You have to set IFS variable to $(echo -en \n\b) , for example:#!/bin/bashSAVEIFS=$IFSIFS=$(echo -en \n\b)find . -group groupname -exec sh -c 'su -c chmod -R u+w,g-w,o-w,g+r,o+r . - groupname {}' \;IFS=$SAVEIFS