/usr/bin/bash: Difference between revisions

Line 901: Line 901:


=== Redirecting Standard Output and Standard Error ===
=== Redirecting Standard Output and Standard Error ===
      This construct allows both the standard output (file descriptor 1) and the standard error  output
この構文は、標準出力(ファイル記述子1)と標準エラー出力(ファイル記述子2)の両方を、wordの展開名を持つファイルにリダイレクトすることを可能にする。
      (file descriptor 2) to be redirected to the file whose name is the expansion of word.


      There are two formats for redirecting standard output and standard error:
標準出力と標準エラーのリダイレクトには2つの形式がある:


              &>word
<code>&>word</code>
      and
              >&word


      Of the two forms, the first is preferred.  This is semantically equivalent to
and


              >word 2>&1
<code>>&word</code>


      When  using the second form, word may not expand to a number or -.  If it does, other redirection
この2つの形式のうち、最初の形式が好まれる。 これは意味的に次のものと等価である。
      operators apply (see Duplicating File Descriptors below) for compatibility reasons.
 
<code>>word 2>&1</code>
 
2番目の形式を使用する場合、wordは数字または-に展開されないかもしれない。 その場合、互換性の理由から、他のリダイレクト演算子が適用される(後述の[[#Duplicating File Descriptors|Duplicating File Descriptors ]]を参照)。


=== Appending Standard Output and Standard Error ===
=== Appending Standard Output and Standard Error ===