'\" te .\" Copyright 1989 AT&T .\" Copyright (c) 2006, 2011, Oracle and/or its affiliates. All rights reserved. .\" Portions Copyright (c) 1992, X/Open Company Limited All Rights Reserved .\" Portions Copyright (c) 1982-2007 AT&T Knowledge Ventures .\" Sun Microsystems, Inc. gratefully acknowledges The Open Group for permission to reproduce portions of its copyrighted documentation. Original documentation from The Open Group can be obtained online at http://www.opengroup.org/bookstore/. .\" The Institute of Electrical and Electronics Engineers and The Open Group, have given us permission to reprint portions of their documentation. In the following statement, the phrase "this text" refers to portions of the system documentation. Portions of this text are reprinted and reproduced in electronic form in the Sun OS Reference Manual, from IEEE Std 1003.1, 2004 Edition, Standard for Information Technology -- Portable Operating System Interface (POSIX), The Open Group Base Specifications Issue 6, Copyright (C) 2001-2004 by the Institute of Electrical and Electronics Engineers, Inc and The Open Group. In the event of any discrepancy between these versions and the original IEEE and The Open Group Standard, the original IEEE and The Open Group Standard is the referee document. The original Standard can be obtained online at http://www.opengroup.org/unix/online.html. This notice shall appear on any product containing this material. .TH cmp 1 "2011 年 7 月 25 日" "SunOS 5.11" "ユーザーコマンド" .SH 名前 cmp \- 2 つのファイルの比較 .SH 形式 .LP .nf \fB/usr/bin/cmp\fR [\fB-l\fR | \fB-s\fR] \fIfile1\fR \fIfile2\fR [\fIskip1\fR] [\fIskip2\fR] .fi .SH 機能説明 .sp .LP \fBcmp\fR は、2 つのファイル \fIfile1\fR と \fIfile2\fR を比較します。2 つのファイルの内容が同じである場合、\fBcmp\fR は何も出力しません。デフォルトでは、ファイルが異なる場合、最初の差異が発生するバイトおよび行が標準出力に書き込まれます。バイト数と行数の初めをそれぞれ \fB1\fR とします。 .sp .LP \fIskip1\fR と \fIskip2\fR はそれぞれ \fIfile1\fR と \fIfile2\fR への初期バイトオフセットであり、8 進数と 10 進数のいずれかになります。先行する \fB0\fR は 8 進数を意味します。 .sp .LP \fIfile1\fR と \fIfiles2\fR のどちらかが \fB-\fR の場合、\fBcmp\fR はそのオペランドに標準入力を使用します。 .SH オプション .sp .LP サポートしているオプションは、次のとおりです。 .sp .ne 2 .mk .na \fB\fB-l\fR\fR .ad .RS 6n .rt 各差異部分について、10 進数のバイト位置と差異部分のバイト長 (8 進数) を書き出します。 .RE .sp .ne 2 .mk .na \fB\fB-s\fR\fR .ad .RS 6n .rt 差異のあるファイルについて何も書き出しません。\fBゼロ以外の\fR終了ステータスのみを返します。 .RE .SH オペランド .sp .LP 次のオペランドがサポートされています。 .sp .ne 2 .mk .na \fB\fIfile1\fR\fR .ad .RS 9n .rt 比較する 1 つ目のファイルのパス名。\fIfile1\fR として \fB-\fR を指定すると、標準入力とみなされます。 .RE .sp .ne 2 .mk .na \fB\fIfile2\fR\fR .ad .RS 9n .rt 比較する 2 つ目のファイルのパス名。\fIfile2\fR として \fB-\fR を指定すると、標準入力とみなされます。 .RE .sp .LP \fIfile1\fR と \fIfile2\fR がどちらも標準入力を指す場合、または同じ\fB先入れ先出し型\fR特殊ファイル、ブロック型特殊ファイル、あるいは文字型特殊ファイルを指す場合、エラーで終了します。 .SH 使用法 .sp .LP ファイルが 2 ギガバイト (2^31 バイト) 以上ある場合の \fBcmp\fR の動作については、\fBlargefile\fR(5) を参照してください。 .SH 使用例 .LP \fB例 1 \fRファイルをバイトごとに比較する .sp .LP 次の例では、\fIfile1\fR と \fIfile2\fR をバイトごとに比較します。 .sp .in +2 .nf example% cmp file1 file2 0 1024 .fi .in -2 .sp .sp .LP 比較を行う前に \fIfile2\fR を 1024 バイト分とばしています。 .SH 環境 .sp .LP \fBcmp\fR の実行に影響を与える次の環境変数についての詳細は、\fBenviron\fR(5) を参照してください。\fBLANG\fR、\fBLC_ALL\fR、\fBLC_CTYPE\fR、\fBLC_MESSAGES\fR、および \fBNLSPATH\fR。 .SH 終了ステータス .sp .LP 次のエラー値が返されます。 .sp .ne 2 .mk .na \fB\fB0\fR\fR .ad .RS 7n .rt 2 つのファイルは同一です。 .RE .sp .ne 2 .mk .na \fB\fB1\fR\fR .ad .RS 7n .rt 2 つのファイルは異なっていました。1 つのファイルがもう一方のファイルの先頭部分と同一の場合も、このコードが返されます。 .RE .sp .ne 2 .mk .na \fB\fB>1\fR \fR .ad .RS 7n .rt エラーが発生した。 .RE .SH 属性 .sp .LP 属性についての詳細は、マニュアルページの \fBattributes\fR(5) を参照してください。 .sp .sp .TS tab() box; cw(2.75i) |cw(2.75i) lw(2.75i) |lw(2.75i) . 属性タイプ属性値 _ 使用条件system/core-os _ CSI有効 _ インタフェースの安定性確実 _ 標準T{ \fBstandards\fR(5) を参照してください。 T} .TE .SH 関連項目 .sp .LP \fBcomm\fR(1), \fBdiff\fR(1), \fBattributes\fR(5), \fBenviron\fR(5), \fBlargefile\fR(5), \fBstandards\fR(5)