BODY { font-family:Arial, Helvetica, sans-serif;font-size:12px; }

You could try "diff --recursive dir1 dir2", and let diff worry about the 
filenames.

Or, if you're dealing with filenames with embedded spaces, you could change 
what Bash thinks the space in the filenames is for, by altering the IFS 
variable:

        IFS    The  Internal  Field  Separator  that is used for word splitting
              after expansion and to split lines  into  words  with  the  read
              builtin  command.   The  default  value  is  


$ echo -e "a\na b\na b c\n" >files  # list of 3 files with embedded spaces
$ cat files
a
a b
a b c

$ for i in $( cat files ) ; do     # This is the undesired behaviour
> echo "--$i--"
> done
--a--
--a--
--b--
--a--
--b--
--c--
$ echo -n "$IFS" | od -bc      # 
0000000 040 011 012
             \t  \n
0000003

$ OLDIFS="$IFS"               # save the original value - messing with IFS can 
be confusing
$ IFS=$( echo -ne "\n\t\n" ) # change IFS to 
$ for i in $( cat files ) ; do echo "--$i--"; done   # and those pesky blanks 
settle right down
--a--
--a b--
--a b c--
$ IFS="$OLDIFS"       # restore saved IFS
$ for i in $( cat files ) ; do echo "--$i--"; done    # and the bad way is back
--a--
--a--
--b--
--a--
--b--
--c--


 On Sun 15/03/09 10:28 , Darcy Whyte darcy.wh...@gmail.com sent:
> Hi,
> 
> I've not tried "Stupid Bash" yet. I'll have to install it sometime.
> 
> I've been using a shell script that looks like this: directoryCompare.sh
> 
> cd $1
> find . | sort > ~/directoryCompareLeft.txt
> cd $2
> find . | sort > ~/directoryCompareRight.txt
> cd ~
> sdiff -s directoryCompareLeft.txt directoryCompareRight.txt >
> directoryCompareResult.txt
> 
> vi directoryCompareResult.txt
> 
> 
> 
> I hope it works on "Stupid Bash".
> 
> 
> 
> Darcy
 
> > On Sat, Mar 14, 2009 at 4:18 PM, 
> ala...@twobikes.ottawa.on.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 an

_______________________________________________
Linux mailing list
Linux@lists.oclug.on.ca
http://oclug.on.ca/mailman/listinfo/linux

Reply via email to