From owner-freebsd-questions@FreeBSD.ORG Mon Sep 10 21:58:58 2007 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 645AE16A418 for ; Mon, 10 Sep 2007 21:58:58 +0000 (UTC) (envelope-from fbsd06@mlists.homeunix.com) Received: from mxout-03.mxes.net (mxout-03.mxes.net [216.86.168.178]) by mx1.freebsd.org (Postfix) with ESMTP id 3A53013C491 for ; Mon, 10 Sep 2007 21:58:58 +0000 (UTC) (envelope-from fbsd06@mlists.homeunix.com) Received: from gumby.homeunix.com. (unknown [87.81.140.128]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by smtp.mxes.net (Postfix) with ESMTP id AD9CB5190F for ; Mon, 10 Sep 2007 17:58:56 -0400 (EDT) Date: Mon, 10 Sep 2007 22:58:53 +0100 From: RW To: freebsd-questions@freebsd.org Message-ID: <20070910225853.6b7321ec@gumby.homeunix.com.> In-Reply-To: References: <94136a2c0709100856q768b101as96e1e6d16312d374@mail.gmail.com> <20070910160607.GA20159@catflap.slightlystrange.org> <20070910161006.GB20159@catflap.slightlystrange.org> <20070910173609.GC20159@catflap.slightlystrange.org> <46E58105.4000200@ridecharge.com> X-Mailer: Claws Mail 3.0.0 (GTK+ 2.10.14; i386-portbld-freebsd6.2) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Subject: Re: chmod / files and directories X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 10 Sep 2007 21:58:58 -0000 On Mon, 10 Sep 2007 15:59:31 -0400 Garance A Drosihn 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.