/usr/bin/bash: Difference between revisions

Line 887: Line 887:


=== Redirecting Output ===
=== Redirecting Output ===
      Redirection of output causes the file whose name results from the expansion of word to be  opened
出力のリダイレクトは、wordを展開した結果の名前を持つファイルを、ファイル記述子n、またはnが指定されていない場合は標準出力(ファイル記述子1)に書き込むためにオープンする。 ファイルが存在しない場合は作成され、存在する場合はサイズがゼロに切り詰められる。
      for  writing  on file descriptor n, or the standard output (file descriptor 1) if n is not speci‐
      fied.  If the file does not exist it is created; if it does exist it is truncated to zero size.


      The general format for redirecting output is:
出力をリダイレクトする一般的な書式は以下の通りである:


              [n]>word
:<code>[n]>word</code>


      If the redirection operator is >, and the noclobber option to the set builtin has  been  enabled,
リダイレクト演算子が>であり、set 組み込み関数の noclobber オプションが有効になっている場合、 word を展開した結果のファイル名が存在し、かつ通常のファイルであれば、 リダイレクトは失敗する。 リダイレクション演算子が<nowiki>>|</nowiki>であるか、リダイレクション演算子が>であり、 set builtinコマンドのnoclobberオプションが有効になっていない場合、 wordで指定された名前のファイルが存在しても、リダイレクションが試みられる。
      the redirection will fail if the file whose name results from the expansion of word exists and is
      a regular file.  If the redirection operator is >|, or the redirection operator is > and the  no‐
      clobber  option  to  the set builtin command is not enabled, the redirection is attempted even if
      the file named by word exists.


=== Appending Redirected Output ===
=== Appending Redirected Output ===