home | list info | list archive | date index | thread index

[OCLUG-Tech] stupid bash question

I have two directories which are mostly the same. I need to compare the files in them (using cmp) to confirm this.

Unfortunately, some of the files (which Other People created, not me) have blanks in the filenames.

I thought I could just go

for i in `cat ListOfFiles`
do
cmp $i $OtherDirectory/$i
done

but it fails on all files with blanks in them.

If I edit ListOfFiles to put \ (or \\) before the blanks, that doesn't work any better (although that worls on an ordinary command line. Neither does putting "" around the filenames in the cmp.

Does anyone have any better suggestions? I'm obviously missing something.

--
Alayne McGregor
alayne at twobikes.ottawa.on.ca

"In Canada we are developing a pattern of life and I know something about one block of that pattern. I
know it for I helped to make it, and I can say that now without any pretense of modesty, or danger of
arrogance, for I know that we who make the patterns are not important, but the pattern is."
-- Nellie McClung, _The Stream Runs Fast_

message navigation