1 .\" This file documents the GNU shell utilities.
3 .\" Copyright (C) 1994 Free Software Foundation, Inc.
5 .\" Permission is granted to make and distribute verbatim copies of this
6 .\" manual provided the copyright notice and this permission notice are
7 .\" preserved on all copies.
9 .\" Permission is granted to copy and distribute modified versions of
10 .\" this manual under the conditions for verbatim copying, provided that
11 .\" the entire resulting derived work is distributed under the terms of a
12 .\" permission notice identical to this one.
14 .\" Permission is granted to copy and distribute translations of this
15 .\" manual into another language, under the above conditions for modified
16 .\" versions, except that this permission notice may be stated in a
17 .\" translation approved by the Foundation.
19 .\" Japanese Version Copyright (c) 1997 NAKANO Takeo, all rights reserved.
20 .\" Translated Thu May 27 1997 by NAKANO Takeo <nakano@apm.seikei.ac.jp>
22 .TH TEST 1 "GNU Shell Utilities" "FSF" \" -*- nroff -*-
24 test \- ファイルの形式のチェックや値の比較を行う
30 {\-\-help,\-\-version}
32 この文書はもうメンテナンスされていないので、不正確・不完全
33 な可能性がある。現在は texinfo 文書が正式な情報となっている。
38 ほとんどのシェルには同じ名前と同様の機能を持った組み込みコマンドが
44 を評価した結果によって、 0(真)または 1(偽)を終了ステータス
46 式は単項式あるいは二項式である。単項式は通常ファイルのステータスを調べ
47 るために用いられる。文字列に対する演算子や数値を比較する演算子もある。
52 \fIfile\fP が存在し、ブロックスペシャルファイルであれば真。
55 \fIfile\fP が存在し、キャラクタスペシャルファイルであれば真。
58 \fIfile\fP が存在し、ディレクトリであれば真。
64 \fIfile\fP が存在し、通常のファイルであれば真。
67 \fIfile\fP が存在し、set GID されていれば真。
70 \fIfile\fP が存在し、 sticky ビットが立っていれば真。
73 \fIfile\fP が存在し、シンボリックリンクであれば真。
76 \fIfile\fP が存在し、名前付きパイプ(named pipe)であれば真。
79 \fIfile\fP が存在し、読み取り可能であれば真。
82 \fIfile\fP が存在し、サイズが 0 より大きければ真。
85 \fIfile\fP が存在し、ソケットであれば真。
91 が省略された場合のデフォルト値は 1(標準出力)。
94 \fIfile\fP が存在し、 set SUID されていれば真。
97 \fIfile\fP が存在し、書き込み可能であれば真。
100 \fIfile\fP が存在し、実行可能であれば真。
103 \fIfile\fP が存在し、実効ユーザー ID による所有であれば真。
106 \fIfile\fP が存在し、実効グループ ID による所有であれば真。
108 \fIfile1\fP \-\fBnt\fP \fIfile2\fP
109 \fIfile1\fP が \fIfile2\fP より(修正時刻で比較して)新しければ真。
111 \fIfile1\fP \-\fBot\fP \fIfile2\fP
112 \fIfile1\fP が \fIfile2\fP より古ければ真。
114 \fIfile1\fP \fB\-ef\fP \fIfile2\fP
115 \fIfile1\fP と \fIfile2\fP のデバイス番号と i-ノード番号が共に等しけれ
119 \fIstring\fP の長さが 0 であれば真。
126 \fIstring1\fP \fB=\fP \fIstring2\fP
129 \fIstring1\fP \fB!=\fP \fIstring2\fP
136 \fIexpr1\fP \-\fBa\fP \fIexpr2\fP
142 \fIexpr1\fP \-\fBo\fP \fIexpr2\fP
148 .I arg1 \fBOP\fP arg2
159 これらの代数比較演算子は、それぞれ \fIarg1\fP が \fIarg2\fP(に等しい、
160 に等しくない、より小さい、より小さいか等しい、より大きい、より大きいか
165 は正の整数、負の整数をとることができる。また \fB\-l\fP \fIstring\fP
166 という特殊な式を指定することもでき、この場合は
172 が引き数一つで実行されたときに限り、以下のオプションが認識される:
175 使い方に関するメッセージを標準出力に表示し、実行成功を返して終了する。
178 バージョン情報を標準出力に表示し、実行成功を返して終了する。