Peng Yu <pengyu...@gmail.com> writes: > I find that "-exec test ..." can be slower than "-exec $(which test) > ...". Is possible that `find` internally use "which", so that users > don't need to explicitly call it?
It's possible, I suppose, but the semantics of -exec can be changed by turning the program name into a specific path. Consider find / -name rm -exec rm {} \; As processing deletes files named 'rm', which program is executed by "-exec rm" can change. Also, there is no certainty that 'which' carries out exactly the same search process as the kernel calls execlp()/execvp(). I can see that there are times when you'd want to do this, but it seems to me that explicitly writing $(which prog) isn't difficult and makes explicit how you're modifying the semantics of 'fimd'. Dale