I’ve to find with a script an executable named Test that take as argument a path, and execute it. I’m doing this with this line:
find -name Test -exec {} path \;
In Test I got an execl:
execl("./Test1","Test1",(char*)0);
perror("Exec failed");
exit(EXIT_FAILURE);
where Test1 is in the same directory of Test . Executing Test “manually” everything goes fine, but using the line written above I have a Exec failed: No such file or directory error.
What’s wrong ?
find executes
Testfrom the directory you are executingfind. If you can change the code for Test, then put the absolute path of Test1:Or you can use
-execdirinstead of-exec:From find manpage: