Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 10 Sep 2007 15:59:31 -0400
From:      Garance A Drosihn <drosih@rpi.edu>
To:        "Philip M. Gollucci" <philip@ridecharge.com>, freebsd-questions@freebsd.org
Subject:   Re: chmod / files and directories
Message-ID:  <p06240802c30b513d7a35@[128.113.24.47]>
In-Reply-To: <46E58105.4000200@ridecharge.com>
References:  <94136a2c0709100856q768b101as96e1e6d16312d374@mail.gmail.com> <20070910160607.GA20159@catflap.slightlystrange.org> <20070910161006.GB20159@catflap.slightlystrange.org> <A2DB3A06-0AC3-4975-AAD0-75638560AC76@gmail.com> <20070910173609.GC20159@catflap.slightlystrange.org> <46E58105.4000200@ridecharge.com>

next in thread | previous in thread | raw e-mail | index | archive | help
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.

Dangerous characters are more of an issue if you do not use the
'-exec' option, and instead you have 'find' print out the filenames
and then use those filenames with some other command.

-- 
Garance Alistair Drosehn            =   gad@gilead.netel.rpi.edu
Senior Systems Programmer           or  gad@freebsd.org
Rensselaer Polytechnic Institute    or  drosih@rpi.edu



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?p06240802c30b513d7a35>