LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 09-02-2002, 04:15 AM   #1
aizkorri
Member
 
Registered: Feb 2002
Location: Basque Country
Distribution: Fedora 14, Ubuntu 14.04
Posts: 434
Blog Entries: 1

Rep: Reputation: 55
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.
 
Old 09-02-2002, 07:32 AM   #2
sarin
Member
 
Registered: May 2001
Location: India, Kerala, Thrissur
Distribution: FC 7-10
Posts: 354
Blog Entries: 2

Rep: Reputation: 34
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 )
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Searching multiple directories and sub directories for a file jeep99899 Linux - Newbie 2 10-13-2005 12:23 PM
Copy files from different directories fiomba Linux - Software 3 02-11-2005 03:01 AM
Copy one file to multiple directories cmfarley19 Linux - General 9 11-10-2004 12:57 PM
How do I copy home directories back? G-wizz Linux - Newbie 5 06-11-2004 06:20 AM
copy directories and subdirectories Red Squirrel Linux - Newbie 2 03-06-2004 09:18 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 01:12 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration