COMPARE
TWO FILE:
cmp $1 $2
if [ $? -eq 0 ]
then
echo "Both files are EQUAL"
else
echo "Both files are NOTEQUAL"
fi
OUTPUT:
[@localhost
~]$ ls
acceptlogin.sh current.sh
file1.sh mark.sh pol
totaldir.sh
add.sh dcurrent.sh file1.txt
new1.c pol.sh tri.sh
a.out eletricity.sh file2.txt
new1.sh raj userlog
big.sh fact fileper new.c
raja.c userlog.sh
big.shwq fact.sh fileper.sh op.sh
series.sh x.txt
com.sh fib.sh firstlet.sh per.sh
subdir.sh y.txt
[@localhost
~]$ sh com.sh fib.sh fact.sh
fib.sh
fact.sh differ: byte 1, line 1
Both
files are NOTEQUAL
[@localhost
~]$
No comments:
Post a Comment
Thanks for your valuable comments