basename is not working as expected if invoked in `` inside a find subcommand

"Andreas R." <[email protected]>
Newsgroups gmane.comp.gnu.utils
Message-ID <[email protected]>
Hi, I have the following task: there are two directories and some of files
in them differ. I try to show a list of files which differ it in the
following way:
> find dir1 -exec diff -q "{}" dir2/`basename {}` \;
or
> find dir1 -exec sh -c "diff -q {} dir2/`basename {}`" \;

but for some reason basename doesn't strip the dir1 prefix from the file
names, e.g. for
> find dir1 -exec echo `basename {}` \;
it just shows all the files as dir1/file1... .
Only
> find dir1 -exec basename {} \;
shows them correctly stripped of the directory name.

Has someone an idea why this happens?

Regards,
Andreas
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.