|
|
Line 655: |
Line 655: |
|
| |
|
| === Tilde Expansion === | | === Tilde Expansion === |
| If a word begins with an unquoted tilde character (`~'), all of the characters preceding the
| | 単語が引用符で囲まれていないチルダ文字(`~')で始まる場合、最初の引用符で囲まれていないスラッシュに先行するすべての文字(引用符で囲まれていないスラッシュがない場合はすべての文字)がチルダ接頭辞とみなされる。 チルダ接頭辞内の文字がどれも引用符で囲まれていない場合、チルダに続くチルダ接頭辞内の文字は、ログイン名として扱われる。 このログイン名がnull |
| first unquoted slash (or all characters, if there is no unquoted slash) are considered a tilde-
| | 文字列の場合、チルダはシェル・パラメータ'''HOME'''の値に置き換えられる。 '''HOME'''が未設定の場合、シェルを実行しているユーザーのホームディレクトリが代わりに置換される。 そうでない場合、チルダ接頭辞は、指定されたログイン名に関連付けられたホームディレクトリに置き換えられる。 |
| prefix. If none of the characters in the tilde-prefix are quoted, the characters in the tilde-
| |
| prefix following the tilde are treated as a possible login name. If this login name is the null
| |
| string, the tilde is replaced with the value of the shell parameter HOME. If HOME is unset, the
| |
| home directory of the user executing the shell is substituted instead. Otherwise, the tilde-pre‐
| |
| fix is replaced with the home directory associated with the specified login name.
| |
|
| |
|
| If the tilde-prefix is a `~+', the value of the shell variable PWD replaces the tilde-prefix. If
| | tilde-prefix が `~+' の場合、シェル変数 PWD の値が tilde-prefix を置き換える。 チルダ接頭辞が `~-' の場合、シェル変数 '''OLDPWD''' が設定されていれば、その値が置き換えられる。tilde-prefixのチルダに続く文字が数字Nで、オプションで先頭に `+' または `-' が付く場合、tilde-prefixはディレクトリスタックの対応する要素に置き換えられる。 tilde-prefixのチルダに続く文字が、先頭に `+' または `-' を含まない数字で構成されている場合、 `+' が仮定される。 |
| the tilde-prefix is a `~-', the value of the shell variable OLDPWD, if it is set, is substituted.
| |
| If the characters following the tilde in the tilde-prefix consist of a number N, optionally pre‐
| |
| fixed by a `+' or a `-', the tilde-prefix is replaced with the corresponding element from the di‐
| |
| rectory stack, as it would be displayed by the dirs builtin invoked with the tilde-prefix as an
| |
| argument. If the characters following the tilde in the tilde-prefix consist of a number without
| |
| a leading `+' or `-', `+' is assumed.
| |
|
| |
|
| If the login name is invalid, or the tilde expansion fails, the word is unchanged.
| | ログイン名が無効であるか、チルダ展開に失敗した場合、その単語は変更されない。 |
|
| |
|
| Each variable assignment is checked for unquoted tilde-prefixes immediately following a : or the
| | 各変数の代入では、:または最初の=の直後に引用符で囲まれていないチルダ接頭辞があるかどうかがチェックされる。 その結果、'''PATH'''、'''MAILPATH'''、'''CDPATH'''への代入でチルダ付きのファイル名を使用することができ、シェルは展開された値を代入する。 |
| first =. In these cases, tilde expansion is also performed. Consequently, one may use filenames
| |
| with tildes in assignments to PATH, MAILPATH, and CDPATH, and the shell assigns the expanded
| |
| value.
| |
|
| |
|
| Bash also performs tilde expansion on words satisfying the conditions of variable assignments (as
| | Bashは、変数代入の条件を満たす単語が単純なコマンドの引数として現れた場合(上記の[[#PARAMETERS|PARAMETERS ]]で説明したとおり)にもチルダ展開を行う。 posixモードでは、上記の宣言コマンドを除き、Bashはこの処理を行わない。 |
| described above under PARAMETERS) when they appear as arguments to simple commands. Bash does
| |
| not do this, except for the declaration commands listed above, when in posix mode.
| |
|
| |
|
| === Parameter Expansion === | | === Parameter Expansion === |