Shell script to compare that given two files are same or not, Programming Languages

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

 

Posted Date: 9/26/2012 8:17:05 AM | Location : United States







Related Discussions:- Shell script to compare that given two files are same or not, Assignment Help, Ask Question on Shell script to compare that given two files are same or not, Get Answer, Expert's Help, Shell script to compare that given two files are same or not Discussions

Write discussion on Shell script to compare that given two files are same or not
Your posts are moderated
Related Questions
Python Programming hmw help!! Write a program that ask the user to input the followings: number of shares, stock price, and broker commission. Last month jim purchased some stock

Assignment is to create hijara game on any plate form, you can use any plate form you like or easy to you. For instance let's say you can use visual studio, game studio (Prefer to

I have a half done program that needs to be finished for a class by tomorrow night. The program will create a database and print out a menu ofoptions (already done). Ive already

Write a script called 'prob3.m' that does the same thing as the previous question except that it makes use of a switch-case construct instead of an if-else. In the file 'hw4.m'

You are required to develop a content management system for the following scenario:   "A Travel Information (NTIK) system is to be designed to allow travellers to access to an elec

program for pyramid in shell script

We will be assuming here that our roots are of the form, in this case, r 1,2 = l + mi If we take the first root we'll find the following solution. x l + m i It i

Lennie McPherson, proprietor of Lennie''s Bail Bonds, needs to calculate the amount due for setting the bail. Lennie requires something of value as collateral, and his fee is 10%

1. Write a function that converts a character array to a signed decimal integer. Function prototype must be as follows: int asciiToInt( char *str, unsigned char* eflag) YOU MAY NO

How to create an ER diagram?