On 2016-06-25 05:07, Ken Moffat wrote:
But now it looks as if only the *last* of alternatives is being
used.  And yet find itself is finding all of them

What I have at hte moment is (one line, although it will wrap here):

find /opt/texlive/${TEXYEAR}/texmf-dist -type f -perm 600 -o -perm
640 -o -perm 700 -exec chmod -v 644 {} \;

From the two runs I can see that there are 667 files with 600 perms,
5 with 640, and 2 with 700.

After the second run I tried:

find /opt/texlive/2016/texmf-dist/ -type f -perm 600 -o -perm 640 -o
-perm 700 | wc -l
672

Running this on the individual files shows 667 with 600 perms and 5
with 640 perms (and 0 now with 700 perms).  I suppose that -exec is
somehow only applying to the last 'or' test.  Guess I'll pipe the
files to xargs for the next run.

You need to use parentheses. "find" implicitly uses the "and" operator between two tests unless another operator is specified:

$ ls -l
total 0
-rw-r----- 1 andreas users 0 25. Jun 07:09 file1
-rw-r----- 1 andreas users 0 25. Jun 07:09 file2
-rw------- 1 andreas users 0 25. Jun 07:09 file3
-rw------- 1 andreas users 0 25. Jun 07:09 file4
$ find . -perm 600 -o -perm 640 -print
./file2
./file1
$ find . -perm 640 -o -perm 600 -print
./file3
./file4
$ find . \( -perm 640 -o -perm 600 \) -print
./file3
./file2
./file1
./file4

In your case, there is an "and" operator between the last permission test and the "exec" action and since the "and" operator has higher precedence than "or", "exec" only works for files that matches the last permission test.

Bye, Andreas
--
http://lists.linuxfromscratch.org/listinfo/lfs-support
FAQ: http://www.linuxfromscratch.org/blfs/faq.html
Unsubscribe: See the above information page

Do not top post on this list.

A: Because it messes up the order in which people normally read text.
Q: Why is top-posting such a bad thing?
A: Top-posting.
Q: What is the most annoying thing in e-mail?

http://en.wikipedia.org/wiki/Posting_style

Reply via email to