IFS="\n" for i in `cat List` do (IFS="\n" cmp $i $otherdir/$i) done "List" contains file names as they are: file 1 file 2 ... (without \, \\ and so on) Good luck! On Sat, Mar 14, 2009 at 3:18 PM, <alayne [ at ] twobikes [ dot ] ottawa [ dot ] on [ dot ] ca> wrote: > 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_ > _______________________________________________ > Linux mailing list > Linux [ at ] lists [ dot ] oclug [ dot ] on [ dot ] ca > http://oclug.on.ca/mailman/listinfo/linux >