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

Re: [OCLUG-Tech] stupid bash question

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, <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
>