The UNIX and Linux Forums  


Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com




View Single Post in the UNIX and Linux Forums - Click on the Thread or Permalink to View Entire Thread -->
  #5 (permalink)  
Old 11-07-2007
ranj@chn ranj@chn is offline Forum Advisor  
Playing with Ubuntu Now!
  
 

Join Date: Oct 2005
Location: Chennai
Posts: 365
comaprison is incorrect

You need to get the file sizes into the variables. For ex,
Code:
a=`wc -c filename1 | nawk '{print $1}` ## can use a combination of ls and nawk too
b=`wc -c filename2 | nawk '{print $1}'` ## can use a combination of ls and nawk too

##Have used nawk as you have mentioned Solaris. Please change to 'awk' otherwise
Now, the if syntax should work correct. Filenames cannot be used to compare the contents of the files!!!