OSDN Git Service

Convert release and draft pages to UTF-8.
[linuxjm/jm.git] / manual / GNU_sh-utils / release / man1 / test.1
1 .\"    This file documents the GNU shell utilities.
2 .\" 
3 .\"    Copyright (C) 1994 Free Software Foundation, Inc.
4 .\" 
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.
8 .\" 
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.
13 .\" 
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.
18 .\" 
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>
21 .\"
22 .TH TEST 1 "GNU Shell Utilities" "FSF" \" -*- nroff -*-
23 .SH 名前
24 test \- ファイルの形式のチェックや値の比較を行う
25 .SH 書式
26 .B test
27 [expr]
28 .br
29 .B test
30 {\-\-help,\-\-version}
31 .SH 説明
32 この文書はもうメンテナンスされていないので、不正確・不完全
33 な可能性がある。現在は texinfo 文書が正式な情報となっている。
34 .PP
35 このマニュアルページは GNU 版
36 .BR test
37 について記述したものである。
38 ほとんどのシェルには同じ名前と同様の機能を持った組み込みコマンドが
39 あることに注意。
40 .PP
41 .B test
42 は条件式
43 .IR expr
44 を評価した結果によって、 0(真)または 1(偽)を終了ステータス
45 として返す。
46 式は単項式あるいは二項式である。単項式は通常ファイルのステータスを調べ
47 るために用いられる。文字列に対する演算子や数値を比較する演算子もある。
48
49 .PD 0
50 .TP
51 .B \-b \fIfile\fP
52 \fIfile\fP が存在し、ブロックスペシャルファイルであれば真。
53 .TP
54 .B \-c \fIfile\fP
55 \fIfile\fP が存在し、キャラクタスペシャルファイルであれば真。
56 .TP
57 .B \-d \fIfile\fP
58 \fIfile\fP が存在し、ディレクトリであれば真。
59 .TP
60 .B \-e \fIfile\fP
61 \fIfile\fP が存在すれば真。
62 .TP
63 .B \-f \fIfile\fP
64 \fIfile\fP が存在し、通常のファイルであれば真。
65 .TP
66 .B \-g \fIfile\fP
67 \fIfile\fP が存在し、set GID されていれば真。
68 .TP
69 .B \-k \fIfile\fP
70 \fIfile\fP が存在し、 sticky ビットが立っていれば真。
71 .TP
72 .B \-L \fIfile\fP
73 \fIfile\fP が存在し、シンボリックリンクであれば真。
74 .TP
75 .B \-p \fIfile\fP
76 \fIfile\fP が存在し、名前付きパイプ(named pipe)であれば真。
77 .TP
78 .B \-r \fIfile\fP
79 \fIfile\fP が存在し、読み取り可能であれば真。
80 .TP
81 .B \-s \fIfile\fP
82 \fIfile\fP が存在し、サイズが 0 より大きければ真。
83 .TP
84 .B \-S \fIfile\fP
85 \fIfile\fP が存在し、ソケットであれば真。
86 .TP
87 .B \-t [\fIfd\fP]
88 .I fd
89 が端末でオープンされていれば真。
90 .I fd
91 が省略された場合のデフォルト値は 1(標準出力)。
92 .TP
93 .B \-u \fIfile\fP
94 \fIfile\fP が存在し、 set SUID されていれば真。
95 .TP
96 .B \-w \fIfile\fP
97 \fIfile\fP が存在し、書き込み可能であれば真。
98 .TP
99 .B \-x \fIfile\fP
100 \fIfile\fP が存在し、実行可能であれば真。
101 .TP
102 .B \-O \fIfile\fP
103 \fIfile\fP が存在し、実効ユーザー ID による所有であれば真。
104 .TP
105 .B \-G \fIfile\fP
106 \fIfile\fP が存在し、実効グループ ID による所有であれば真。
107 .TP
108 \fIfile1\fP \-\fBnt\fP \fIfile2\fP
109 \fIfile1\fP が \fIfile2\fP より(修正時刻で比較して)新しければ真。
110 .TP
111 \fIfile1\fP \-\fBot\fP \fIfile2\fP
112 \fIfile1\fP が \fIfile2\fP より古ければ真。
113 .TP
114 \fIfile1\fP \fB\-ef\fP \fIfile2\fP
115 \fIfile1\fP と \fIfile2\fP のデバイス番号と i-ノード番号が共に等しけれ
116 ば真。
117 .TP
118 .B \-z \fIstring\fP
119 \fIstring\fP の長さが 0 であれば真。
120 .TP
121 .B \-n \fIstring\fP
122 .TP
123 .I string
124 の長さが 0 より大きければ真。
125 .TP
126 \fIstring1\fP \fB=\fP \fIstring2\fP
127 二つの文字列が等しければ真。
128 .TP
129 \fIstring1\fP \fB!=\fP \fIstring2\fP
130 二つの文字列が等しくなければ真。
131 .TP
132 .B ! \fIexpr\fP
133 .I expr
134 が偽であれば真。
135 .TP
136 \fIexpr1\fP \-\fBa\fP \fIexpr2\fP
137 .I expr1
138
139 .I expr2
140 の両方が真であれば真。
141 .TP
142 \fIexpr1\fP \-\fBo\fP \fIexpr2\fP
143 .I expr1
144
145 .I expr2
146 のどちらかが真であれば真。
147 .TP
148 .I arg1 \fBOP\fP arg2
149 .SM
150 .B OP
151
152 .BR \-eq 、
153 .BR \-ne 、
154 .BR \-lt 、
155 .BR \-le 、
156 .BR \-gt 、
157 .BR \-ge 
158 のいずれか。
159 これらの代数比較演算子は、それぞれ \fIarg1\fP が \fIarg2\fP(に等しい、
160 に等しくない、より小さい、より小さいか等しい、より大きい、より大きいか
161 等しい)条件を満たせば真。
162 .I arg1
163 および
164 .I arg2
165 は正の整数、負の整数をとることができる。また  \fB\-l\fP \fIstring\fP 
166 という特殊な式を指定することもでき、この場合は
167 .IR string
168 の長さとなる。
169 .SS オプション
170 GNU
171 .B test
172 が引き数一つで実行されたときに限り、以下のオプションが認識される:
173 .TP
174 .I "\-\-help"
175 使い方に関するメッセージを標準出力に表示し、実行成功を返して終了する。
176 .TP
177 .I "\-\-version"
178 バージョン情報を標準出力に表示し、実行成功を返して終了する。
179