Compare 2 Files

Hi

requirement : I have file a and b. need to compare both are matching.

FIle a
----

/ct/mr/test/bin/b
/ct/mr/test/bin/CheckEmpty
/ct/mr/test/bin/ChkFile2

File b
---

/ct/mr/test/bin/CheckEmpty
/ct/mr/test/bin/ChkFile2
/ct/mr/test/bin/b

Eventhough content is same it is in different order.

The shell script
-------------

#!/usr/bin/sh

if diff  a b  > /dev/null
then
    echo "Files are the same"
    else
    echo "Files are different"
fi

this gives output files are different.

Question : how to make same order and compare 2 files.
Could any one help on this

Thanks in advance
Hari

Sort the files and compare:

 diff <(sort a) <(sort b)

Guru.

No point in using diff if you're going to throw away its output. Just use cmp, after sorting as guruprasadpr suggests.

Regards,
Alister

thanks to both of you