\begin{Rick Welykochy}
> On Wed, 21 Mar 2001, Rodos wrote:
> > >
> > > We've needed a script-pissing contest ...
> > >
> > >    for f in /home/*; do cp file.file $f; done
> > 
> > Well I was going with
> > 
> > find . -maxdepth 1 -exec cp file.file {} \;
> > 
> > but its a little longer than yours Rick.
> > 
> > Now I see why people use one character switches on commands, it helps you
> > win script-pissing contests. Facing using -maxdepth when -j would suffice!
> 
> updated:
> 
> for u in /home/*; do if [ -d $u ]; then cp file.file $u; chown $u.$u $u/file.file; 
>fi; done

creates backup files, sets owner and permissions, reads home
directory, etc out of /etc/passwd - only taking uids > 1000 and
ignoring "nobody" (uid = 65534):

 awk -F: '$3>1000 && $1!="nobody" {print $3,$4,$6}' /etc/passwd | \
  while read u g h; do install -b -m 644 -o $u -g $g file.file $h; done

you may want to change the condition in the awk script to suit local
policy.

-- 
 - Gus

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

Reply via email to