/usr/bin/bash: Difference between revisions

Line 147: Line 147:


=== Lists ===
=== Lists ===
      A list is a sequence of one or more pipelines separated by one of the operators ;, &, &&, or  ||,
リストは、1つ以上のパイプラインを<nowiki> ;, &, &&, ||</nowiki> のいずれかの演算子で区切り、オプションで <nowiki>;, &, <newline></nowiki> のいずれかで終了させるシーケンスである。
      and optionally terminated by one of ;, &, or <newline>.


      Of  these  list operators, && and || have equal precedence, followed by ; and &, which have equal
これらのリスト演算子のうち、<nowiki>&&</nowiki>と<nowiki>||</nowiki>は等しい優先順位を持ち、次いで ; & が等しい優先順位を持つ。
      precedence.


      A sequence of one or more newlines may appear in a list instead of a semicolon  to  delimit  com‐
コマンドを区切るセミコロンの代わりに、1つ以上の改行がリスト中に現れることもある。
      mands.


      If a command is terminated by the control operator &, the shell executes the command in the back‐
コマンドが制御演算子&で終了する場合、シェルはサブシェルでバックグラウンドでコマンドを実行する。 シェルはコマンドの終了を待たず、リターン・ステータスは0になる。これらは非同期コマンドと呼ばれる。 で区切られたコマンドは順次実行され、シェルは各コマンドが順番に終了するのを待つ。 リターン・ステータスは、最後に実行されたコマンドの終了ステータスである。
      ground in a subshell.  The shell does not wait for the command to finish, and the  return  status
      is  0.  These  are referred to as asynchronous commands.  Commands separated by a ; are executed
      sequentially; the shell waits for each command to terminate in turn.  The return  status  is  the
      exit status of the last command executed.


      AND and OR lists are sequences of one or more pipelines separated by the && and || control opera‐
ANDリストとORリストは、それぞれ&&||制御演算子で区切られた1つ以上のパイプラインのシーケンスである。 ANDリストとORリストは左連想で実行される。 ANDリストは次のような形式を持つ。
      tors, respectively.  AND and OR lists are executed with left associativity.  An AND list has  the
      form


              command1 && command2
:<code>command1 && command2</code>


      command2 is executed if, and only if, command1 returns an exit status of zero (success).
command2が実行されるのは、command1が0(成功)の終了ステータスを返した場合のみである。


      An OR list has the form
ORリストは次のような形をしている。


              command1 || command2
:<code>command1 || command2</code>


      command2 is executed if, and only if, command1 returns a non-zero exit status.  The return status
command2が実行されるのは、command1がゼロ以外の終了ステータスを返した場合のみである。 ANDリストとORリストの戻りステータスは、リスト内で最後に実行されたコマンドの終了ステータスである。
      of AND and OR lists is the exit status of the last command executed in the list.


=== Compound Commands ===
=== Compound Commands ===