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

2007-04-10 Thread Andreas R.
Paul Jarc wrote: >>> find dir1 -exec diff -q "{}" dir2/`basename {}` \; > > Here, the command substitution is expanded by the shell before find > runs. basename sees the literal argument {}, and so it outputs {}, > and find sees dir2/{}. > >>> find dir1 -exec sh -c "diff -q {} dir2/`basename {}`

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

2007-04-10 Thread Andreas R.
Paul Jarc wrote: >>> find dir1 -exec diff -q "{}" dir2/`basename {}` \; > > Here, the command substitution is expanded by the shell before find > runs. basename sees the literal argument {}, and so it outputs {}, > and find sees dir2/{}. > >>> find dir1 -exec sh -c "diff -q {} dir2/`basename {}`"

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

2007-04-10 Thread Paul Jarc
"Andreas R." <[EMAIL PROTECTED]> wrote: > find dir1 -type f -exec sh -c 'echo "{}" dir2/"`basename "{}"`"' \; > it works, but I still don't understand completely why it works. Actually, it still won't work in some cases. If a filename contains a double quote, like 'foo" "bar', the shell will se