help-gnu-utils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


From: Andreas R.
Subject: basename is not working as expected if invoked in `` inside a find subcommand
Date: Mon, 09 Apr 2007 15:52:35 +0200
User-agent: KNode/0.10.4

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



reply via email to

[Prev in Thread] Current Thread [Next in Thread]