On Fri, 15 Aug 2025, Štěpán Němec wrote:

If not sticking to pure find(1):

Compact, but slow, and filenames cannot contain (')--single quotes.

$ find /dir/ -type f -exec sh -c "test -x '{}' && echo '{}'" \;

Slightly faster, and should handle weird filenames:

$ find /dir/ -type f -exec sh -c 'for f; do test -x "$f" && echo "$f"; done' 
xxx {} +

This is behaviorally different from OP's command in that
test -x tests for executability by the process running it,
not for "at least one execute bit set".


Thanks. A distinction I missed: of course there can exist files executable by
others, but not by you.

-RVP

Reply via email to