The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Dummies Questions & Answers
Google UNIX.COM



Thread: diff
View Single Post in UNIX Forums - Click on the Thread or Permalink to View Entire Thread -->
  #4 (permalink)  
Old 04-25-2007
DeepakS's Avatar
DeepakS DeepakS is offline
Registered User
 

Join Date: Aug 2006
Posts: 60
This should take care of it:

Code:
for x in 1 2 3 4 5 6 7 8 9 10
do
	### FILE TRANSFER CODE    ###
	### SHOULD BE PLACED HERE ###

	if [ -f $F_NAME1 ]	# TESTS TO SEE IF FILE 1 EXISTS
				# -s WOULD CHECK FOR EXISTANCE AND SIZE > 0
	then
		/usr/bin/diff $F_PATH/$F_NAME1 $F_PATH/$F_NAME2 >> /dev/null 2>&1

		if [ $? -eq 0 ] 
		then    # NO CHANGE
			rm $F_PATH/$F_NAME1
			break
		else	# CHANGE
			rm $F_PATH/$F_NAME2
			uuencode $F_PATH/$F_NAME1 $F_NAME1| mailx -s "$F_NAME1 CHANGED" $NC_EMAIL
			break
		fi
	else
		sleep $SLEEP_INT  # INTERVAL TO SLEEP IN SECONDS
	fi
done

Last edited by DeepakS; 04-25-2007 at 08:11 AM.
Reply With Quote