might work. you could filter for directories where you don't want to copy this file, like lost+found, etc... or just go behind yourself and remove them by hand.
if you want to match on a specific group and not just the one listed on the user's home dir (which is what i think you're asking for) then this might work:
for I in `ls -1 /home |awk '{print $1}'`;do
if [ "$I" != "lost+found" ]
then
for J in `groups $I`;do
if [ "$J" = "groupname" ]
then
cp <file> /home/$I;
fi
done
fi
done
while not foolproof, it at least skips the lost+found directory, if your home dirs are in a filesystem of their own. you could tweak something like this and place it in a script if the file copy task is something you do on a regular basis.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.