|   |   | 
| Line 1,056: | Line 1,056: | 
|  | 
 |  | 
 | 
|  | == CONDITIONAL EXPRESSIONS == |  | == CONDITIONAL EXPRESSIONS == | 
|  |        Conditional  expressions  are used by the [[compound command and the test and [builtin commands
 |  | 条件式は、<nowiki>[[</nowiki> 複合コマンド、test および [ 組み込みコマンドで使用され、ファイル属性のテストや文字列比較、算術比較を実行する。 testコマンドと<nowiki>[</nowiki> コマンドは、引数の数に基づいて動作を決定する。その他のコマンド固有の動作については、これらのコマンドの説明を参照のこと。 | 
|  |        to test file attributes and perform string and arithmetic comparisons.  The test and  [ commands
 |  | 
|  |        determine their behavior based on the number of arguments; see the descriptions of those commands
 |  | 
|  |        for any other command-specific actions.
 |  | 
|  | 
 |  | 
 | 
|  |        Expressions are formed from the following unary or binary primaries.  Bash handles several  file‐
 |  | 式は、以下の単項または二項のプライマリから形成される。 Bashは、いくつかのファイル名が式の中で使われている場合、それらを特別に扱う。 bashが動作しているオペレーティング・システムがこれらの特別なファイルを提供している場合、bashはそれらを使用する: プライマリの1つのファイル引数が/dev/fd/nの場合、ファイル記述子nがチェックされる。 プライマリへのファイル引数が /dev/stdin、/dev/stdout、/dev/stderr のいずれかである場合、 それぞれファイル記述子 0、1、2 がチェックされる。 | 
|  |        names specially when they are used in expressions.  If the operating system on which bash is run‐
 |  | 
|  |        ning provides these special files, bash will use them; otherwise it will emulate them  internally
 |  | 
|  |        with  this  behavior: If any file argument to one of the primaries is of the form /dev/fd/n, then
 |  | 
|  |        file descriptor n is checked.  If the file argument to one of the primaries is one of /dev/stdin,
 |  | 
|  |        /dev/stdout, or /dev/stderr, file descriptor 0, 1, or 2, respectively, is checked.
 |  | 
|  | 
 |  | 
 | 
|  |        Unless  otherwise specified, primaries that operate on files follow symbolic links and operate on
 |  | 特に指定がない限り、ファイルを操作するプライマリはシンボリックリンクに従い、リンクそのものではなくリンク先を操作する。 | 
|  |        the target of the link, rather than the link itself.
 |  | 
|  | 
 |  | 
 | 
|  |        When used with [[, the <and >operators sort lexicographically using the  current locale.   The
 |  | <nowiki>[[</nowiki>と一緒に使うと、<nowiki><[</nowiki> 演算子と <nowiki>></nowiki> 演算子は、現在のロケールを使って辞書順にソートする。  testコマンドはASCII順序でソートする。 | 
|  |        test command sorts using ASCII ordering.
 |  | 
|  | 
 |  | 
 | 
|  |        -a file
 |  | :;-a file | 
|  |               Trueif file exists.
 |  | ::ファイルが存在するならば True | 
|  |        -b file
 |  | :;-b file | 
|  |               Trueif file exists and is a block special file.
 |  | ::ファイルが存在し、ブロックスペシャルファイルならば True | 
|  |        -c file
 |  | :;-c file | 
|  |               Trueif file exists and is a character special file.
 |  | ::ファイルが存在し、キャラクタースペシャルファイルならば True | 
|  |        -d file
 |  | :;-d file | 
|  |               Trueif file exists and is a directory.
 |  | ::ファイルが存在し、ディレクトリーならば True | 
|  |        -e file
 |  | :;-e file | 
|  |               Trueif file exists.
 |  | ::ファイルが存在するならば True | 
|  |        -f file
 |  | :;-f file | 
|  |               Trueif file exists and is a regular file.
 |  | ::ファイルが存在し、、レギュラーファイルならば True | 
|  |        -g file
 |  | :;-g file | 
|  |               True if file exists and is set-group-id.
 |  | ::ファイルが存在し set-group-id ならば True | 
|  |        -h file
 |  | :;-h file | 
|  |               Trueif file exists and is a symbolic link.
 |  | ::ファイルが存在し、シンボリックリンクならば True | 
|  |        -k file
 |  | :;-k file | 
|  |               True if file exists and its ``sticky''bit is set.
 |  | ::ファイルが存在し、その``sticky'' ビットがセットされているならば True | 
|  |        -p file
 |  | :;-p file | 
|  |               Trueif file exists and is a named pipe (FIFO).
 |  | ::ファイルが存在しファイルが存在し、名前付きパイプ(FIFO)であれば True | 
|  |        -r file
 |  | :;-r file | 
|  |               Trueif file exists and is readable.
 |  | ::ファイルが存在し、readableであれば True | 
|  |        -s file
 |  | :;-s file | 
|  |               Trueif file exists and has a size greater than zero.
 |  | ::ファイルが存在し、0より大きいファイルサイズであれば True | 
|  |        -t fd  Trueif file descriptor fd is open and refers to a terminal.
 |  | :;-t fd    | 
|  |        -u file
 |  | ::ファイル記述子fdがオープンされていて、端末を参照していれば True | 
|  |               True if file exists and its set-user-idbit is set.
 |  | :;-u file | 
|  |        -w file
 |  | ::ファイルが存在し、その set-user-id bitがセットされていれば True | 
|  |               Trueif file exists and is writable.
 |  | :;-w file | 
|  |        -x file
 |  | ::ファイルが存在し、writableであるならば True | 
|  |               Trueif file exists and is executable.
 |  | :;-x file | 
|  |        -G file
 |  | ::ファイルが存在し、executableであるならば True | 
|  |               True if file exists and is owned by the effective group id.
 |  | :;-G file | 
|  |        -L file
 |  | ::ファイルが存在し、有効なグループIDが所有していれば、True | 
|  |               True if file exists and is a symbolic link.
 |  | :;-L file | 
|  |        -N file
 |  | ::ファイルが存在し、シンボリックリンクであれば、True | 
|  |               Trueif file exists and has been modified since it was last read.
 |  | :;-N file | 
|  |        -O file
 |  | ::ファイルが存在し、最後に読み込まれてから変更されていれば True | 
|  |               Trueif file exists and is owned by the effective user id.
 |  | :;-O file | 
|  |        -S file
 |  | ::ファイルが存在し、有効なユーザIDに所有されていれば True | 
|  |               Trueif file exists and is a socket.
 |  | :;-S file | 
|  |        file1 -ef file2
 |  | ::ファイルが存在し、ソケットであれば True | 
|  |               Trueif file1 and file2 refer to the same device and inode numbers.
 |  | :;file1 -ef file2 | 
|  |        file1 -nt file2
 |  | ::file1とfile2が、同じデバイスとinode番号に参照されていれば True | 
|  |               True if file1 is newer (according to modification date) than file2, or if file1 exists and
 |  | :;file1 -nt file2 | 
|  |               file2 does not.
 |  | ::file1がfile2より(更新日付に従って)新しい場合、またはfile1が存在しfile2が存在しない場合、True | 
|  |        file1 -ot file2
 |  | :;file1 -ot file2 | 
|  |               Trueif file1 is older than file2, or if file2 exists and file1 does not.
 |  | ::file1がfile2より古い場合、またはfile2が存在しfile1が存在しない場合に True | 
|  |        -o optname
 |  | :;-o optname | 
|  |               True if the shell option optnameis enabled.  See the list of options under  the  descrip‐
 |  | ::シェル・オプション optname が有効なら True。以下のset組み込み関数の-oオプションの説明の下にあるオプションのリストを参照のこと。 | 
|  |               tion of the -o option to the set builtin below.
 |  | :;-v varname | 
|  |        -v varname
 |  | ::シェル変数varnameが設定されている(値が割り当てられている)場合は True | 
|  |               Trueif the shell variable varname is set (has been assigned a value).
 |  | :;-R varname | 
|  |        -R varname
 |  | ::シェル変数 varname が設定されていて、名前参照であれば True | 
|  |               Trueif the shell variable varname is set and is a name reference.
 |  | :;-z string | 
|  |        -z string
 |  | ::文字列の長さが 0であれば True | 
|  |               Trueif the length of string is zero.
 |  | :;string | 
|  |        string
 |  | :;-n string | 
|  |        -n string
 |  | ::文字列の長さが 0以外であれば True | 
|  |               Trueif the length of string is non-zero.
 |  | 
|  | 
 |  | 
 | 
|  |        string1 == string2
 |  | :;string1 == string2 | 
|  |        string1 = string2
 |  | :;string1 = string2 | 
|  |               True  if  the strings are equal.  = should be used with the test command for POSIX confor‐
 |  | ::POSIXに準拠するためには、testコマンドと一緒に使う必要がある。 <nowiki>[[</nowiki>コマンドと一緒に使うと、上記の(Compound Commands)で説明したパターンマッチングを行う。 | 
|  |               mance.  When used with the [[command, this performs pattern matching as  described  above
 |  | 
|  |               (Compound Commands).
 |  | 
|  | 
 |  | 
 | 
|  |        string1 != string2
 |  | :;string1 != string2 | 
|  |               Trueif the strings are not equal.
 |  | ::文字列が等しくなければ True | 
|  | 
 |  | 
 | 
|  |        string1 < string2
 |  | :;string1 < string2 | 
|  |               Trueif string1 sorts before string2 lexicographically.
 |  | ::文字列1が文字列2より辞書順に先にソートされていれば True | 
|  | 
 |  | 
 | 
|  |        string1 > string2
 |  | :;string1 > string2 | 
|  |               Trueif string1 sorts after string2 lexicographically.
 |  | ::文字列1が文字列2の後に辞書式にソートされていれば True | 
|  | 
 |  | 
 | 
|  |        arg1 OP arg2
 |  | :;arg1 OP arg2 | 
|  |               OP  is  one  of -eq, -ne, -lt, -le, -gt, or -ge.  These arithmetic binary operators return
 |  | ::OPは-eq、-ne、-lt、-le、-gt、-geのいずれかである。これらの算術二項演算子は、それぞれ arg1 が arg2 と等しい、等しくない、未満、以下、以上、または以上の場合に true を返します。arg1とarg2は、正または負の整数である。<nowiki>[[</nowiki>コマンドと併用すると、Arg1とArg2は算術式として評価される(上記の[[#ARITHMETIC EVALUATION|ARITHMETIC EVALUATION ]]を参照)。 | 
|  |               true if arg1is equal to, not equal to, less than, less than or equal to, greater than, or
 |  | 
|  |               greater  than  or  equal to arg2, respectively.  Arg1 and arg2 may be positive or negative
 |  | 
|  |               integers.  When used with the [[command, Arg1 and Arg2 are evaluated  as  arithmetic  ex‐
 |  | 
|  |               pressions (see ARITHMETIC EVALUATIONabove).
 |  | 
|  | 
 |  | 
 | 
|  | == SIMPLE COMMAND EXPANSION == |  | == SIMPLE COMMAND EXPANSION == |