From owner-freebsd-questions@FreeBSD.ORG Mon Sep 10 21:06:15 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 859B516A46E for ; Mon, 10 Sep 2007 21:06:15 +0000 (UTC) (envelope-from drosih@rpi.edu) Received: from smtp8.server.rpi.edu (smtp8.server.rpi.edu [128.113.2.228]) by mx1.freebsd.org (Postfix) with ESMTP id AE0B113C4D5 for ; Mon, 10 Sep 2007 21:06:12 +0000 (UTC) (envelope-from drosih@rpi.edu) Received: from [128.113.24.47] (gilead.netel.rpi.edu [128.113.24.47]) by smtp8.server.rpi.edu (8.13.1/8.13.1) with ESMTP id l8AJxW9a004909; Mon, 10 Sep 2007 15:59:33 -0400 Mime-Version: 1.0 Message-Id: In-Reply-To: <46E58105.4000200@ridecharge.com> References: <94136a2c0709100856q768b101as96e1e6d16312d374@mail.gmail.com> <20070910160607.GA20159@catflap.slightlystrange.org> <20070910161006.GB20159@catflap.slightlystrange.org> <20070910173609.GC20159@catflap.slightlystrange.org> <46E58105.4000200@ridecharge.com> Date: Mon, 10 Sep 2007 15:59:31 -0400 To: "Philip M. Gollucci" , freebsd-questions@freebsd.org From: Garance A Drosihn Content-Type: text/plain; charset="us-ascii" ; format="flowed" X-RPI-SA-Score: undef - spam scanning disabled X-CanItPRO-Stream: default X-Canit-Stats-ID: Bayes signature not available X-Scanned-By: CanIt (www . roaringpenguin . com) on 128.113.2.228 Cc: 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:06:15 -0000 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