Is it possible to compare two files which reside on different UNIX boxes?
(I'm using HP POSIX/Korn)
Consider the scenario of a pre-production environment (box 1) and a production environment (box 2) I would like to check if some files on both boxes match or not.
It's quite straightforward on one box:
#----------------------------------------------------
# Function to compares files and display differences
#
# $1 = file1, $2 = file2
#
# cmp with option -s gives the following return codes:
# 0 - identical
# 1 - different
# 2 - inaccessable/other
#----------------------------------------------------
function fn030_compare_file {
cmp -s $1 $2
if [[ $? -gt 0 ]]
then
echo "*** Difference in files! -----> $1 <---> $2"
else
echo "*** OK, Files identical -----> $1 <---> $2"
fi
return
}
The only alternative I can think of is to copy the files to one box, then compare from there.
NOTE: I found an excellent shell script which recursively compares the contents of two directories on one box (to find this do a google search on "cmptree"...)