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.

M.

-- 
WebCentral Pty Ltd           Australia's #1 Internet Web Hosting Company
Level 1, 96 Lytton Road.           Network Operations - Systems Engineer
PO Box 4169, East Brisbane.                       phone: +61 7 3249 2583
Queensland, Australia.                            pgp key id: 0x900E515F



_______________________________________________
Redhat-list mailing list
[EMAIL PROTECTED]
https://listman.redhat.com/mailman/listinfo/redhat-list

Reply via email to