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

Re: Bash script problem



On Fri, Aug 06, 2021 at 10:52:51AM +1000, David wrote:

[...]

> I was commenting on how I have always been puzzled why
> someone made the effort to give 'chmod' an '-R' option, but
> never made it actually useful for common cases. As it is,
> it seems that it's really only useful for modifying the write attribute.

It doesn't cover all the cases, but you're aware of the 'X' variant
for chmod (aka: turn on the x bit if a directory, but also if it
has already an x bit somewhere else, alas):

  tomas@trotzki:~$ ls -ald f*b
  -rw-r--r-- 1 tomas tomas    0 Aug  6 08:49 fib
  drwxr-xr-x 2 tomas tomas 4096 Aug  6 08:48 fob
  -rwxr--r-- 1 tomas tomas    0 Aug  6 08:48 fub

  tomas@trotzki:~$ chmod go+X f?b

  tomas@trotzki:~$ ls -ald f*b
  -rw-r--r-- 1 tomas tomas    0 Aug  6 08:49 fib
  drwxr-xr-x 2 tomas tomas 4096 Aug  6 08:48 fob
  -rwxr-xr-x 1 tomas tomas    0 Aug  6 08:48 fub

It might /sometimes/ do what you want (i.e. in the most common case
where you want dirs to have the x bit set, but regular files not).

Cheers
 - t

Attachment: signature.asc
Description: Digital signature


Reply to: