Careful: chmod -X also looks for any existing exec bits:
$ umask 0$ >foo >bar$ ls -al foo bar
-rw-rw-rw- 1 user group 0 Sep 10 00:00 bar
-rw-rw-rw- 1 user group 0 Sep 10 00:00 foo
$ chmod o+x foo$ ls -al foo bar
-rw-rw-rw- 1 user group 0 Sep 10 00:00 bar
-rw-rw-rwx 1 user group 0 Sep 10 00:00 foo
$ chmod u=rwX,g=rX,o=rX foo bar$ ls -al foo bar
-rw-r--r-- 1 user group 0 Sep 10 00:00 bar
-rwxr-xr-x 1 user group 0 Sep 10 00:00 foo
This is exactly what I expect, so I never got tripped up by this. But yes, it’s worth pointing out that this will expand the executable flag on files that are already executable and set it on folders too. But not set it on files that aren’t executable at all.
u=rwX,g=rX,o=rX because this won’t make every file executable, only folders.
Careful:
chmod -Xalso looks for any existing exec bits:$ umask 0 $ >foo >bar $ ls -al foo bar -rw-rw-rw- 1 user group 0 Sep 10 00:00 bar -rw-rw-rw- 1 user group 0 Sep 10 00:00 foo $ chmod o+x foo $ ls -al foo bar -rw-rw-rw- 1 user group 0 Sep 10 00:00 bar -rw-rw-rwx 1 user group 0 Sep 10 00:00 foo $ chmod u=rwX,g=rX,o=rX foo bar $ ls -al foo bar -rw-r--r-- 1 user group 0 Sep 10 00:00 bar -rwxr-xr-x 1 user group 0 Sep 10 00:00 fooThis is exactly what I expect, so I never got tripped up by this. But yes, it’s worth pointing out that this will expand the executable flag on files that are already executable and set it on folders too. But not set it on files that aren’t executable at all.
Looks like a handy flag