cmprm

NAME
        cmprm

SYNOPSIS
        cmprm FILE1 FILE2

DESCRIPTION
        compare FILE1 and FILE2, delete FILE1 if both files are identical

Use case:

 $ ls -l file*
-rw-r--r-- 1 gmonard users 31 Apr 17 09:39 file1
-rw-r--r-- 1 gmonard users 24 Apr 17 09:39 file2
-rw-r--r-- 1 gmonard users 31 Apr 17 11:15 file3
 $ cat file1
computational
chemistry
rocks!
 $ cat file2
marry
had
a little
lamb
 $ cat file3
computational
chemistry
rocks!
 $ ../cmprm file1 file2
file1 identical to file2
 $ ls -l file*
-rw-r--r-- 1 gmonard users 31 Apr 17 09:39 file1
-rw-r--r-- 1 gmonard users 24 Apr 17 09:39 file2
-rw-r--r-- 1 gmonard users 31 Apr 17 11:15 file3
 $ ../cmprm file1 file3
remove file file1
 $ ls -l file*
-rw-r--r-- 1 gmonard users 24 Apr 17 09:39 file2
-rw-r--r-- 1 gmonard users 31 Apr 17 11:15 file3

Commands to include in your script: cmp, rm