On 2017-04-13, Jean-Yves Baudais <
jean-yve...@insa-rennes.fr> wrote:
> Hello,
>
> "chmod -R u+w *" change the file mode only for the content of the
> directory
This this only changes modes for the items in the current directory
which match the expression *. If any of the items are directories, then
it recurses into those.
The * expression doesn't match directory entries which begin with a
period.
Thus the command will not change the permissions of something
called .foo, and won't recurse into it either, if it is a directory.
This is because the chmod command will not even receive such an
item as an argument. The shell expands the * expression into an
argument list of matching directory entries. This happens before
chmod is invoked. The program will only operate on the items named by
its command line arguments, and with -R, will recurse into those that
are directories.
If you mean "this directory and all its children", then just say so:
chmod -R u+w .
The name . (dot) refers to the current directory, because every
directory has an entry by that name which points to itself.
> and the sub-directory in my computer (GNU bash, version
> 4.3.46(1)-release x86_64-pc-linux-gnu). I would like to change the mode
> for all the content (sub and subsub and subsubsub-directory... till
> around 10 levels) and I expected "chmod -R" would do. How can I do that?
Why would you expect chmod -R to only go until around 10 levels?
"Around 10 levels" logically clashes with your requirement to
process "all the content". If there are 11 levels, and we only descent
to 10 levels, we are not changing the permissions of "all the content",
are we.
If around 10 levels is all the depth you actually have, then stating
this as a requirement is confusing and needless; it adds nothing
to "all the content".