C de-Avillez wrote:
> I cannot explain the following difference between running a 'find -exec
> basename {}', and a 'find -exec echo $(basename {})', and the same for
> dirname.
The shell is processing $(...) on the command line before passing the
result as an argument to the command. You can see this using echo.
> cer...@xango:~/Téléchargements$ find . -type f -exec echo
> $(/usr/local/bin/basename {}) \;
Try this:
$ echo find . -type f -exec echo $(/usr/local/bin/basename {}) \;
find . -type f -exec echo {} ;
As you can see the result of "$(basename {})" is "{}". This is passed
to 'find'. Then 'find' is executing based upon the arguments in the
resulting invocation.
Bob