cmp(1) DG/UX 4.30 cmp(1)
NAME
cmp - compare two files
SYNOPSIS
cmp [ -l ] [ -s ] file1 file2
DESCRIPTION
Cmp compares two files. (If file1 is -, the standard input
is used.) Under all options, cmp makes no comment if the
files are the same. If the files differ, cmp announces the
byte and line number where the difference occurred. If one
file is an initial subsequence of the other, that fact is
noted.
Options:
-l Print the byte number (decimal) and the differing
bytes (octal) for each difference.
-s Print nothing for differing files; return codes only.
If the files are the same, cmp prints nothing.
EXAMPLES
$ cmp -l oldmembers currentmembers
This example will compare the file "old_members" with the
file "current_members" and report all differences.
$ cmp -s allowed users
This example will compare the file "allowed" with the file
"users" and return a standard exit code but no other output.
This is useful to compare two files then test the exit code
in a shell script.
SEE ALSO
comm(1), diff(1), berk_diff(1).
DIAGNOSTICS
Exit code 0 is returned for identical files, 1 for different
files, and 2 for an inaccessible file or missing argument.
Licensed material--property of copyright holder(s) Page 1