LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (http://www.linuxquestions.org/questions/programming-9/)
-   -   How to copy one file in all users directories (http://www.linuxquestions.org/questions/programming-9/how-to-copy-one-file-in-all-users-directories-29390/)

aizkorri 09-02-2002 05:15 AM

How to copy one file in all users directories
 
Hi, I'm trying to do a script that copies some files in users directories as superuser,
for example, I want everyone to have the same .emacs file, but I cannot copy it one by one cause they're 100, I would like to do a script that copyes it to everyone at once.
How could I do that?
thnx.

sarin 09-02-2002 08:32 AM

try
for usr in /home/*
do
cp /root/file $user/
done

--Sarin
( You can also grep and cut the passwd file to get a user list, trim it and do something like for usr in `cat /tmp/lst`; do cp /root/file ~$usr/; done; and many more fancy things )


All times are GMT -5. The time now is 05:17 PM.