Search code examples
bashfindexecute

How to find and execute?


All find and execute examples are a variation of this (with /bin/rm) :

find /tmp -name core -type f -print0 | xargs -0 /bin/rm -f

but I couldn't find how to find and execute files (assuming they are executable).

So, how to find and execute files from bash script?

I tried it like this (and similar variations) :

find $ROOT_PATH -executable  -name unittests_runner.exe -exec {}

Solution

  • You only need to add a "\;" at the end of your line, like:

    find $ROOT_PATH -executable  -name unittests_runner.exe -exec {} \;
    

    et voilá...