On Sat, 3 Feb 2001, Matthew Melvin wrote:
> On Fri, 2 Feb 2001 at 1:54pm (-0000), Tristan Hill wrote:
>
> > I've got the following bash function to print the name of all directories
> > relative to the current path and change each directories permission. The
> > script fail to pickup directories with a space in the name though.
> > Corrections to the script would be much appreciated.
> >
> >
> > #!/bin/bash
> >
> > for each in `find . -name "*"`
> >
> > do
> >
> > if [ -d "$each" ]; then
> >
> > echo "$each"
> > chmod 2770 "$each";
> >
> > fi
> >
> > done
> >
>
> For this we can simplify it alot and get find to do all the work for us...
>
> find . -type d -exec chmod 2770 {} \;
>
> ... and because the file name is never passed throug shell we don't have to
> worry about any spaces.
you might also consider using "xargs" to avoid having to run a separate
chmod command for every single directory you locate.
rday
--
Robert P. J. Day
Eno River Technologies, Durham NC
Unix, Linux and Open Source training
"This is Microsoft technical support. How may I misinform you?"
_______________________________________________
Redhat-list mailing list
[EMAIL PROTECTED]
https://listman.redhat.com/mailman/listinfo/redhat-list