chmod / files and directories

RW fbsd06 at mlists.homeunix.com
Mon Sep 10 14:58:58 PDT 2007


On Mon, 10 Sep 2007 15:59:31 -0400
Garance A Drosihn <drosih at rpi.edu> wrote:

> At 1:38 PM -0400 9/10/07, Philip M. Gollucci wrote:
> >Daniel Bye wrote:
> >>  On Mon, Sep 10, 2007 at 10:01:35PM +0530, Shantanoo Mahajan wrote:
> >  >> # find /usr/local/www/data/wp -type f -exec chmod 644 '{}' \;
> >>>  # find /usr/local/www/data/wp -type d -exec chmod 755 '{}' \;
> >>>
> >>>  To be on safer side. :)
> >>
> >>  Oh? Safer how? I've never come across that idiom before.
> >
> >If imange the file or directory name has spaces, (){}-, etc.. in
> >it or even \.
> 
> This is not necessary with -exec in the 'find' command, and the
> single-quotes wouldn't have any effect.  The {} is a parameter
> which is seen by the find command itself.  If you add single-quotes
> around the {}, those quotes are stripped off by the *shell* before
> handing the parameter off to the 'find' command.

And special characters in the filenames aren't a problem since "find"
passes the arguments directly to  chmod as an array of null-terminated
strings, so they don't get interpreted by the shell.




More information about the freebsd-questions mailing list