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

Re: recurse does not work?



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 {} +

or somesuch.

Cheers
-- t

Attachment: signature.asc
Description: Digital signature


Reply to: