/usr/bin/bash: Difference between revisions

Line 623: Line 623:


== EXPANSION ==
== EXPANSION ==
      Expansion  is  performed on the command line after it has been split into words.  There are seven
拡張は、コマンドラインを単語に分割した後に実行される。 ブレース展開、チルダ展開、パラメータと変数の展開、コマンド置換、算術展開、単語分割、パス名展開の7種類の展開が行われる。
      kinds of expansion performed: brace expansion, tilde expansion, parameter and variable expansion,
      command substitution, arithmetic expansion, word splitting, and pathname expansion.


      The  order  of expansions is: brace expansion; tilde expansion, parameter and variable expansion,
展開の順序は、波括弧展開、チルダ展開、パラメータと変数の展開、算術展開、コマンドの置換(左から右へ行う)、単語の分割、パス名の展開である。
      arithmetic expansion, and command substitution (done in a left-to-right fashion); word splitting;
      and pathname expansion.


      On systems that can support it, there is an additional expansion available: process substitution.
これをサポートするシステムでは、さらにプロセス置換という拡張が利用できる。これは、チルダ、パラメータ、変数、算術展開、コマンド置換と同時に実行される。
      This is performed at the same time as tilde, parameter, variable, and  arithmetic  expansion  and
      command substitution.


      After  these  expansions are performed, quote characters present in the original word are removed
これらの拡張が実行された後、元の単語に存在する引用符文字は、それ自体が引用符で囲まれていない限り削除される(引用符除去)。
      unless they have been quoted themselves (quote removal).


      Only brace expansion, word splitting, and pathname expansion can increase the number of words  of
ブレース展開、単語分割、パス名展開だけが展開の単語数を増やすことができ、他の展開は1つの単語を1つの単語に展開する。 唯一の例外は、<nowiki>"$@"</nowiki>と<nowiki>"${name[@]}"</nowiki>の展開、そしてほとんどの場合、上で説明した$*と<nowiki>${name[*]}</nowiki>の展開である([[#PARAMETERS|PARAMETERS ]]を参照)。
      the  expansion;  other  expansions expand a single word to a single word.  The only exceptions to
      this are the expansions of "$@" and "${name[@]}", and, in most cases, $* and  ${name[*]} as  ex‐
      plained above (see PARAMETERS).


=== Brace Expansion ===
=== Brace Expansion ===