Peter Hardy was once rumoured to have said:
> Did I get in first? :-)
> 
> On Wed, Mar 21, 2001 at 12:16:35PM +1100, Bernhard L?der wrote:
> > I have to copy a file to all user directories.
> > 
> > cp file.file /home/*
> > 
> > will only copy file.file to the first user not all users. How would I do
> > this without listing the individual directories
> 
> for user in `ls /home`
> do cp file.file /home/$user
> done

Actually, if you want to be polite, you might want to consider:

for user in `ls /home`; do
  cp file.file /home/$user
  chown $user /home/$user/file.file
done

-- 
--==============================================--
  Crossfire      | This email was brought to you
  [EMAIL PROTECTED] | on 100% Recycled Electrons
--==============================================--

-- 
SLUG - Sydney Linux User Group Mailing List - http://slug.org.au/
More Info: http://slug.org.au/lists/listinfo/slug

Reply via email to