I want to take all files from the current directory and give them to "locate" to check if they are elsewhere. So I started with
find -maxdepth 1 -type f -name "libd*" -exec locate {} ';'
But this does not work because find returns the names in a form like "./libdrm.so" and locate does not work with the leading dot. So I thought locate -b should help:
find -maxdepth 1 -type f -name "libd*" -exec locate -b {} ';'
Unfortunately, locate -b ./libdrm.so does not work, I regard this as a bug. So I tried it with basename:
find -maxdepth 1 -type f -name "libd*" -exec locate \`basename {}\` ';'
This does not work either because `basename {}` is resolved first and the result is "-exec locate '{}' ';'".
Any idea how I can pass "locate `basename {}`" to the exec?