Re: select executables
On Mar 13, 7:36 pm, Aggelidis Nikos <aggelidis.n...@gmail.com> wrote:
> Hi,
>
> is it possible to select all executable files from a directory tree?
>
> I tried using find with -exec but i couldn't make it work
>
> find -type f -exec
> if test -x "{}"
> then
> echo "found an executable"
> fi
> \;
>
> i tried making a function like this
>
> function Qexe ()
> {
> if test -x "$1"
> then
> echo "found an executable"
> fi
>
> }
>
> and then call it from find like this
>
> find -type f -exec Qexe "{}" \;
>
> but again it didn't work.
>
> thanks in advance for your ,
> -nicolas
>
> PS: i think that my question could be generalized if it is possible to
> you your own predicate in find...
find . \
-type f \
\( -perm -u+x -o -perm -g+x -o -perm -o+x \) \
-exec echo {} is executable \; \
-prune \
-o \
-type f \
-exec echo {} is not executable \;
|