|
|
Line 146: |
Line 146: |
|
| |
|
| === Redirections === | | === Redirections === |
| Redirections are used to change where a command reads its input or sends its output. In general,
| | リダイレクションは、コマンドが入力を読み取る場所や出力を送信する場所を変更するために使用する。 一般的には、次のようになる。 |
| redirections open, close, or duplicate an existing reference to a file. The overall format used for
| | リダイレクションは、ファイルへの既存の参照を開いたり閉じたり、複製したりする。 リダイレクトに使用される全体的な形式は |
| redirection is:
| | リダイレクトに使用される全体的な形式は次のとおりである: |
|
| |
|
| [n] redir-op file
| | :[n] redir-op file |
|
| |
|
| where redir-op is one of the redirection operators mentioned previously. Following is a list of the
| | ここで、redir-opは前述のリダイレクト演算子の1つである。 以下は、可能なリダイレクションのリストである。 |
| possible redirections. The [n] is an optional number between 0 and 9, as in ‘3’ (not ‘[3]’), that
| | 可能なリダイレクションのリストである。 [n]は0から9までの任意の数字で、'3'('[3]'ではない)のように、ファイルディスクリプタを参照するものである。 |
| refers to a file descriptor.
| |
|
| |
|
| [n]> file Redirect standard output (or n) to file.
| | :[n]> file Redirect standard output (or n) to file. |
|
| |
|
| [n]>| file Same, but override the -C option.
| | :[n]>| file Same, but override the -C option. |
|
| |
|
| [n]>> file Append standard output (or n) to file.
| | :[n]>> file Append standard output (or n) to file. |
|
| |
|
| [n]< file Redirect standard input (or n) from file.
| | :[n]< file Redirect standard input (or n) from file. |
|
| |
|
| [n1]<&n2 Copy file descriptor n2 as stdout (or fd n1). fd n2.
| | :[n1]<&n2 Copy file descriptor n2 as stdout (or fd n1). fd n2. |
|
| |
|
| [n]<&- Close standard input (or n).
| | :[n]<&- Close standard input (or n). |
|
| |
|
| [n1]>&n2 Copy file descriptor n2 as stdin (or fd n1). fd n2.
| | :[n1]>&n2 Copy file descriptor n2 as stdin (or fd n1). fd n2. |
|
| |
|
| [n]>&- Close standard output (or n).
| | :[n]>&- Close standard output (or n). |
|
| |
|
| [n]<> file Open file for reading and writing on standard input (or n).
| | :[n]<> file Open file for reading and writing on standard input (or n). |
|
| |
|
| The following redirection is often called a “here-document”.
| | 以下のようなリダイレクトを「here-document」と呼ぶことがある。 |
|
| |
|
| [n]<< delimiter
| | :[n]<< delimiter |
| here-doc-text ...
| | ::here-doc-text ... |
| delimiter
| | :delimiter |
|
| |
|
| All the text on successive lines up to the delimiter is saved away and made available to the command
| | 区切り文字までの連続した行のテキストはすべて保存され、標準入力、またはファイルディスクリプタnが指定されている場合は、そのコマンドで利用できるようになる。 最初の行で指定された区切り文字が引用符で囲まれている場合、here-doc-textは文字通りに扱われる。それ以外の場合は,パラメータ展開,コマンド置換,算術展開(「展開」の項を参照)が行われる.“Expansions”のセクションで説明されている)。 演算子が"<<"でなく"<<-"の場合、here-doc-textの先頭のタブは取り除かれる。 |
| on standard input, or file descriptor n if it is specified. If the delimiter as specified on the ini‐
| |
| tial line is quoted, then the here-doc-text is treated literally, otherwise the text is subjected to
| |
| parameter expansion, command substitution, and arithmetic expansion (as described in the section on
| |
| “Expansions”). If the operator is “<<-” instead of “<<”, then leading tabs in the here-doc-text are
| |
| stripped.
| |
|
| |
|
| === Search and Execution === | | === Search and Execution === |