normal 0 false false false en-us x-none


W.A.S.S to compare that given two files are same or not. If found same then delete the second file.

  echo -e "Enter the 1st File name : \c"

read ffname

echo -e "Enter the 2nd File name : \c"

read sfname

res=`cmp $ffname $sfname|wc -l`

//cmp is used for comparing two files and return where those are different

if [ $res -eq 1 ]

then

         echo "Both files are not same"

else

         echo "Both files are same"

         rm $sfname

fi

 

Output

sh  compare.sh

 

Enter the 1st File name : t1.txt

Enter the 2nd File name : t2.txt

Both files are same

 

Request for Solution File

Ask an Expert for Answer!!
Application Programming: normal 0 false false false en-us x-none
Reference No:- TGS0161554

Expected delivery within 24 Hours