[bash] Parse files

Hi

I've 2 folder A and B, they have files with the same name but different content.
I mean

A contain---------> aa.txt, bb.txt, cc.txt

B contain---------> aa.txt, bb.txt, cc.txt

but aa.txt in A has different content from aa.txt in B.

I'd like to parse the homonyms files in pairs using a script bash. In other words I want analize both aa.txt, then both bb.txt, etc..

Any idea?

thanks in advance

D.

for file in A/*
do
  diff $file B/`basename $file`
done

Hi

really it doesn't work.
Return with No file or directory. But both files are in the folders

Seems like an error on the path

thanks

D

Are you running the script in the same base directory as folder A and B. Otherwise modify your script accordingly to point it to the right place.

Yes

really i give it the complete path like:

for file in /home/user/Desktop/A/*  do

    diff $file /home/user/Desktop/B/'basename $file'

done

its not 'basename blah blah' its `basename blah blah`.

The ` indicates a shell escape.

ok thank you

now it works

Don't use ` ... `.

Use $( ... )

It's easier to read... will save you on spectacles in the long run!