On Tue, 11 Jun 2002, Simon Bryan wrote:

> I have all my users home directories under /home/popusers/
> it turns out I may need to add a directory and set permissions on it in each
> users directory (there are over 900 of them).
> Is there a simple way to do this? Say the directory needs to be called
> 'attach' in an existing 'dot' directory.

Write a little script.

#!/bin/bash
 for z in *; do
    mkdir -p $z/dot/attach;
    chown -R $z:$z $z/dot/attach;
    chmod -R 755 $z/dot/attach;
 done

Save this, stick it in /home, chmod it to 700 and run it.

Come back after coffee and look for the results. The important line is the
second one - sets a loop which looks through all the entries in the
current directory, and performs the following commands on them. The
variable z simply holds the next name in the queue being read from the
list of directory names.

DaZZa


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

Reply via email to