Changeset View
Changeset View
Standalone View
Standalone View
usr.bin/cmp/cmp.1
Show First 20 Lines • Show All 101 Lines • ▼ Show 20 Lines | |||||
option has not been specified, | option has not been specified, | ||||
.Nm | .Nm | ||||
writes to standard error that EOF was reached in the shorter | writes to standard error that EOF was reached in the shorter | ||||
file (before any differences were found). | file (before any differences were found). | ||||
.It >1 | .It >1 | ||||
An error occurred. | An error occurred. | ||||
.El | .El | ||||
.Sh EXAMPLES | .Sh EXAMPLES | ||||
Assuming a file named example.txt with the following contents: | Assuming a file named | ||||
.Pa example.txt | |||||
with the following contents: | |||||
.Bd -literal -offset indent | .Bd -literal -offset indent | ||||
a | a | ||||
b | b | ||||
c | c | ||||
.Ed | .Ed | ||||
.Pp | .Pp | ||||
Compare stdin with example.txt: | Compare stdin with | ||||
.Pa example.txt : | |||||
.Bd -literal -offset indent | .Bd -literal -offset indent | ||||
$ echo -e "a\\nb\\nc" | cmp - example.txt | $ echo -e "a\\nb\\nc" | cmp - example.txt | ||||
.Ed | .Ed | ||||
.Pp | .Pp | ||||
Same as above but introducing a change in byte three in stdin. | Same as above but introducing a change in the third byte of stdin. | ||||
0mp: I am not sure but maybe //a change in the third byte of stdin// would sound better. | |||||
Show the byte number (decimal) and differing byte (octal): | Show the byte number (decimal) and differing byte (octal): | ||||
.Bd -literal -offset indent | .Bd -literal -offset indent | ||||
$ echo -e "a\\nR\\nc" | cmp -l - example.txt | $ echo -e "a\\nR\\nc" | cmp -l - example.txt | ||||
3 122 142 | 3 122 142 | ||||
.Ed | .Ed | ||||
.Pp | .Pp | ||||
Compare example.txt and /boot/loader.conf exiting if size differs. | Compare file sizes of | ||||
.Pa example.txt | |||||
and | |||||
.Pa /boot/loader.conf | |||||
and return 1 if they are not equal. | |||||
Done Inline ActionsHow about Compare file sizes of A and B and return 1 if they are not equal. 0mp: How about //Compare file sizes of A and B and return 1 if they are not equal.// | |||||
Note that | Note that | ||||
.Fl z | .Fl z | ||||
can only be used with regular files: | can only be used with regular files: | ||||
.Bd -literal -offset indent | .Bd -literal -offset indent | ||||
$ cmp -z example.txt /boot/loader.conf | $ cmp -z example.txt /boot/loader.conf | ||||
example.txt /boot/loader.conf differ: size | example.txt /boot/loader.conf differ: size | ||||
.Ed | .Ed | ||||
.Pp | .Pp | ||||
Compare stdin with file example.txt omitting the 4 first bytes from stdin and | Compare stdin with | ||||
the 2 first bytes from example.txt: | .Pa example.txt | ||||
omitting the first 4 bytes from stdin and the first 2 bytes from | |||||
Done Inline ActionsShouldn't it be the first 4 bytes and the first 2 bytes instead? 0mp: Shouldn't it be //the first 4 bytes// and //the first 2 bytes// instead? | |||||
.Pa example.txt : | |||||
.Bd -literal -offset indent | .Bd -literal -offset indent | ||||
$ echo -e "a\\nR\\nb\\nc" | cmp - example.txt 4 2 | $ echo -e "a\\nR\\nb\\nc" | cmp - example.txt 4 2 | ||||
.Ed | .Ed | ||||
.Sh SEE ALSO | .Sh SEE ALSO | ||||
.Xr diff 1 , | .Xr diff 1 , | ||||
.Xr diff3 1 | .Xr diff3 1 | ||||
.Sh STANDARDS | .Sh STANDARDS | ||||
The | The | ||||
Show All 15 Lines |
I am not sure but maybe a change in the third byte of stdin would sound better.