[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: recurse does not work?



On Wed, Nov 20, 2019 at 11:58:16AM -0500, Greg Wooledge wrote:
> On Wed, Nov 20, 2019 at 07:55:33PM +0300, Reco wrote:
> > On Wed, Nov 20, 2019 at 05:03:36PM +0100, tomas@tuxteam.de wrote:
> > > I'd recommend using the more flexible find, like so:
> > > 
> > >   find ping -type f -name "*.sh" -exec chmod -v +x {} +
> > 
> > find ping -type f -name '*.sh' -print0 | xargs -0 chmod +x
> 
> Both are safe for all files, regardless of special characters in their
> names.  The -exec + version is modestly more efficient.

Exactly. If you are piping find's result, as reco suggests, (and
sometimes that makes sense, too) the print0 is recommended. If
you're doing -exec directly, -print0 doesn't make any difference
(nothing is being printed, after all ;-)

Cheers
-- t

Attachment: signature.asc
Description: Digital signature


Reply to: