You can use diff -q or –brief options to report only when files differ. diff -q or –brief option does not display the difference, only prints that the files differ.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
## diff -q or --brief option echo -e "1\n2\n3\n4" > myfile1 ## create some files echo -e "1\n2\n3\n4" > myfile2 diff -q myfile1 myfile2 ## returns nothing echo -e "2\n1\n4\n5\n6" > myfile2 ## do some changes diff -q myfile1 myfile2 ## returns Files myfile1 and myfile2 differ diff myfile1 myfile2 ## returns the actual difference as shown below ## 1d0 ## < 1 ## 3c2 ## < 3 ## --- ## > 1 ## 4a4,5 ## > 5 ## > 6 |