aboutsummaryrefslogtreecommitdiff
path: root/ja/man/man1/test.1
diff options
context:
space:
mode:
Diffstat (limited to 'ja/man/man1/test.1')
-rw-r--r--ja/man/man1/test.1220
1 files changed, 220 insertions, 0 deletions
diff --git a/ja/man/man1/test.1 b/ja/man/man1/test.1
new file mode 100644
index 0000000000..ec33e41a09
--- /dev/null
+++ b/ja/man/man1/test.1
@@ -0,0 +1,220 @@
+.\" Copyright (c) 1991, 1993
+.\" The Regents of the University of California. All rights reserved.
+.\"
+.\" This code is derived from software contributed to Berkeley by
+.\" the Institute of Electrical and Electronics Engineers, Inc.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\" 3. All advertising materials mentioning features or use of this software
+.\" must display the following acknowledgement:
+.\" This product includes software developed by the University of
+.\" California, Berkeley and its contributors.
+.\" 4. Neither the name of the University nor the names of its contributors
+.\" may be used to endorse or promote products derived from this software
+.\" without specific prior written permission.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" @(#)test.1 8.1 (Berkeley) 5/31/93
+.\" jpman %Id: test.1,v 1.2 1997/03/31 03:43:49 ryo2 Stab %
+.\" %Id: test.1,v 1.2.8.1 1997/06/02 06:40:08 charnier Exp %
+.\"
+.Dd May 31, 1993
+.Dt TEST 1
+.Os
+.Sh 名称
+.Nm test
+.Nd 条件式を評価する
+.Sh 書式
+.Nm test
+.Ar expression
+.Sh 解説
+.Nm test
+ユーティリティは、式を評価し、結果が真なら 0 (true)を、
+偽なら 1 (false) を戻り値として返します。引数の式がない
+場合も 1 (false) を返します。
+.Pp
+演算子やフラグなどは、一つ一つ独立な引数として
+.Nm test
+ユーティリティに渡します。
+.Pp
+式は以下の基本要素から構成されます:
+.Bl -tag -width Ar
+.It Fl b Ar file
+.Ar file
+が存在し、それがブロック特殊ファイルであるならば真になります。
+.It Fl c Ar file
+.Ar file
+が存在し、それがキャラクタ特殊ファイルであるならば真になります。
+.It Fl d Ar file
+.Ar file
+が存在し、それがディレクトリであるならば真になります。
+.It Fl e Ar file
+.Ar file
+が存在すれば真になります (ファイルの種類に依りません)。
+.It Fl f Ar file
+.Ar file
+が存在し、それが通常ファイルであるならば真になります。
+.It Fl g Ar file
+.Ar file
+が存在し、それに setgid (フラグが立っていれば真になります。
+.It Fl h Ar file
+.Ar file
+が存在し、それがシンボリックリンクであるならば真になります。
+.It Fl n Ar string
+.Ar string
+の長さが 0 でなければ真になります。
+.It Fl p Ar file
+.Ar file
+が名前つきパイプ
+.Po Tn FIFO Pc
+であるならば真になります。
+.It Fl r Ar file
+.Ar file
+が存在し、それが読み込み可能であれば真になります。
+.It Fl s Ar file
+.Ar file
+が存在し、そのファイルサイズが 0 より大きければ真になります。
+.It Fl t Ar [file_descriptor]
+ファイルディスクリプタ番号が
+.Ar file_descriptor
+(デフォルトでは1) であるファイルがオープンされており、これが端末に
+結びつけられていれば
+真になります。
+.It Fl u Ar file
+.Ar file
+が存在し、それに setuid フラグが立っていれば真になります。
+.It Fl w Ar file
+.Ar file
+が存在し、書き込み可能であれば真になります。真ということは、
+書き込み可能フラグが立っていることを表すに過ぎません。
+ファイルが読み込み専用のファイルシステム上にあると、たとえ
+この判定が真であっても書き込みはできません。
+.It Fl x Ar file
+.Ar file
+が存在し、実行可能であれば真になります。真ということは、
+実行可能フラグが立っていることを表すに過ぎません。
+.Ar file
+がディレクトリの場合、真は
+.Ar file
+が検索可能であることを表します。
+.It Fl z Ar string
+.Ar string
+の長さが 0 であれば真になります。
+.It Ar string
+.Ar string
+がナル文字列でなければ真になります。
+.It Ar \&s\&1 Cm \&= Ar \&s\&2
+文字列
+.Ar \&s\&1
+と
+.Ar \&s\&2
+が同一であれば真になります。
+.It Ar \&s\&1 Cm \&!= Ar \&s\&2
+文字列
+.Ar \&s\&1
+と
+.Ar \&s\&2
+が同一でなければ真になります。
+.It Ar \&n\&1 Fl \&eq Ar \&n\&2
+整数
+.Ar \&n\&1
+と
+.Ar \&n\&2
+が等しければ真になります。
+.It Ar \&n\&1 Fl \&ne Ar \&n\&2
+整数
+.Ar \&n\&1
+と
+.Ar \&n\&2
+が等しくなければ真になります。
+.It Ar \&n\&1 Fl \&gt Ar \&n\&2
+整数
+.Ar \&n\&1
+が
+.Ar \&n\&2
+がより大きければ真になります。
+.It Ar \&n\&1 Fl \&ge Ar \&n\&2
+整数
+.Ar \&n\&1
+が
+.Ar \&n\&2
+より大きいか等しければ真になります。
+.It Ar \&n\&1 Fl \&lt Ar \&n\&2
+整数
+.Ar \&n\&1
+が
+.Ar \&n\&2
+より小さければ真になります。
+.It Ar \&n\&1 Fl \&le Ar \&n\&2
+整数
+.Ar \&n\&1
+が
+.Ar \&n\&2
+より小さいか等しければ真になります。
+.El
+.Pp
+これらの基本要素は以下の演算子と組み合わせることができます:
+.Bl -tag -width Ar
+.It Cm \&! Ar expression
+.Ar expression
+が偽ならば真になります。
+.It Ar expression1 Fl a Ar expression2
+.Ar expression1
+と
+.Ar expression2
+の両方が真ならば真になります。
+.It Ar expression1 Fl o Ar expression2
+.Ar expression1
+と
+.Ar expression2
+のどちらかが真ならば真になります。
+.It Cm \&( Ns Ar expression Ns Cm \&)
+.Ar expression
+が真ならば真になります。
+.El
+.Pp
+.Fl a
+演算子は
+.Fl o
+演算子より優先されます。
+.Sh 文法の曖昧性
+.Nm test
+に使用されている文法は本質的に曖昧です。ある程度の一貫性を確保するため、
+.St -p1003.2
+の D11.2/4.62.4 節で述べられているケースに関しては、この標準化文書が
+規定する規則に一貫して従った評価が行われます。しかしその他のケース
+では、コマンドの持つ意味の曖昧さに左右されます。
+.Sh 戻り値
+.Nm test
+ユーティリティは次のいずれかの値を返します。
+.Bl -tag -width Ds
+.It 0
+式を評価した結果が真である
+.It 1
+式を評価した結果が偽であるか、式がない
+.It >1
+エラーが発生した
+.El
+.Sh 標準
+.Nm test
+の機能は、
+.St -p1003.2
+互換を想定しています。