NetBSD-Users archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
Re: Find all files with at least one execute bit set
On ago 15 21:23, RVP wrote:
> On Fri, 15 Aug 2025, Alistair Crooks wrote:
>
> > Just a thought:
> >
> > find /dir/ -type f -ls | awk '$3 ~ /x/ { print $NF }'
> >
>
> Fine thought. +1.
>
> -RVP
Thanks to all for the suggestions, the discussion and the possible
solutions.
I have no constraints in using find(1) alone, but I would like to keep
things POSIX, as simple as possible and as lightweight/quick
as possible (as regards system resources).
Also thanks for pointing out that the `-executable' option in GNU
find actually uses `test -x' (I didn't know), which is called for
each file: I would like to avoid this, as well as `sh -c' itself.
Moreover, probably `test -x' won't work if (as mentioned) the user
who runs it has no permission to run the file (but other users may
have such a permission, so the result of the test will be somewhat
incorrect).
Due to the `-perm /mode' syntax (which is different from BSD find
-mode), probably GNU find is more flexible.
However, probably the best solution is the one with awk! It's "exotic",
but quick and simple, and not run for each file.
Rocky
Home |
Main Index |
Thread Index |
Old Index