Re: recurse does not work?
Hi.
On Wed, Nov 20, 2019 at 05:03:36PM +0100, tomas@tuxteam.de wrote:
> On Wed, Nov 20, 2019 at 02:06:07PM +0000, Bonno Bloksma wrote:
> > Hi,
> >
> > I have a directory with some sub directories and all of those have one or more shells scripts.
> > This script need the execute bit set so I thought a simple chmod -R -v +x ping/*.sh would do it, NOT :-(
> ^^^^^^^^^
>
> I think the problem is there.
>
> The shell expands "ping/*.sh", so chmod only "sees" the files
> matching that pattern (i.e. some *.sh directly beneath ping)
> gets hit.
>
> Now the -R of chmod doesn't support patterns -- so that wouldn't
> be a viable option either.
>
> 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
Because you never know if there's that pesky space inside the filename.
Reco
Reply to: