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
Rocky Hotas wrote in
<gkve7yxpeygg5mwk5xecltkucu5rl7ukqspwjvwnqjkcz36jsk@5knbp3xh2lsh>:
|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.
But that -ls is BSD only.
--steffen
|
|Der Kragenbaer, The moon bear,
|der holt sich munter he cheerfully and one by one
|einen nach dem anderen runter wa.ks himself off
|(By Robert Gernhardt)
Home |
Main Index |
Thread Index |
Old Index