• R/O
  • SSH
  • HTTPS

yash: Commit


Commit MetaInfo

Revision3818 (tree)
Zeit2017-11-11 15:32:24
Autormagicant

Log Message

doc: More on command substitution

Ändern Zusammenfassung

Diff

--- yash/trunk/doc/expand.txt (revision 3817)
+++ yash/trunk/doc/expand.txt (revision 3818)
@@ -392,13 +392,18 @@
392392 parsed.
393393
394394 If command substitution is of the form +`{{commands}}`+,
395-the {{commands}} are not parsed when the command substitution is parsed.
395+the {{commands}} are not parsed when the command substitution is parsed;
396+the {{commands}} are parsed each time the command substitution is expanded.
396397 The end of {{commands}} is detected by the first backquote character (+`+)
397398 after the beginning of {{commands}} that is not
398399 link:syntax.html#quotes[quoted] by a backslash.
399400 Backquotes that are part of {{commands}} (typically used for nested command
400401 substitution) must be quoted by backslashes.
401-The {{commands}} are parsed each time the command substitution is expanded.
402+In {{commands}}, backslashes are treated as quotes only when preceding a
403+dollar (+$+), backquote, newline, or another backslash. Additionally, if the
404+command substitution occurs inside double quotes, double quotes in
405+{{commands}} must be quoted with a backslash. Those backslashes are removed
406+before {{commands}} are parsed.
402407
403408 [[arith]]
404409 == Arithmetic expansion
--- yash/trunk/doc/ja/expand.txt (revision 3817)
+++ yash/trunk/doc/ja/expand.txt (revision 3818)
@@ -228,7 +228,7 @@
228228
229229 +$(+ と +)+ で囲んだコマンド置換の{{コマンド}}は、コマンド置換の入れ子やリダイレクトなどを考慮して予め解析されます。従って、+$(+ と +)+ の間には基本的に通常通りコマンドを書くことができます。ただし、<<arith,数式展開>>との混同を避けるため、中の{{コマンド}}が +(+ で始まる場合は{{コマンド}}の最初に空白を挿し挟んでください。
230230
231-+&#x60;+ で囲むコマンド置換では、コマンド置換の入れ子などは考慮せずに、{{コマンド}}の中に最初に (バックスラッシュでlink:syntax.html#quotes[クォート]していない) +&#x60;+ が現れたところでコマンド置換の終わりとみなされます。+&#x60;+ で囲んだコマンド置換の中に +&#x60;+ で囲んだコマンド置換を書く場合は、内側の +&#x60;+ をバックスラッシュでクォートする必要があります。その他、{{コマンド}}の一部として +&#x60;+ を入れたいときは、(それが{{コマンド}}内部で一重または二重引用符でクォートされていても) バックスラッシュでクォートする必要があります。
231++&#x60;+ で囲むコマンド置換では、コマンド置換の入れ子などは考慮せずに、{{コマンド}}の中に最初に (バックスラッシュでlink:syntax.html#quotes[クォート]していない) +&#x60;+ が現れたところでコマンド置換の終わりとみなされます。+&#x60;+ で囲んだコマンド置換の中に +&#x60;+ で囲んだコマンド置換を書く場合は、内側の +&#x60;+ をバックスラッシュでクォートする必要があります。その他、{{コマンド}}の一部として +&#x60;+ を入れたいときは、(それが{{コマンド}}内部で一重または二重引用符でクォートされていても) バックスラッシュでクォートする必要があります。{{コマンド}}の中ではバックスラッシュは ++$++・++&#x60;++・バックスラッシュ・改行の直前にある場合のみ引用符として扱われます。また、++&#x60;++ で囲んだコマンド置換が二重引用符の中で使われる場合は、{{コマンド}}の中に現れる二重引用符もバックスラッシュでクォートする必要があります。これらのバックスラッシュは{{コマンド}}が解析される前に削除されます。
232232
233233 +$(+ と +)+ で囲んだコマンド置換の中のコマンドは、そのコマンド置換を含むコマンドを解析する時に一緒に解析されます (link:posix.html[POSIX 準拠モード]を除く)。+`+ で囲んだコマンド置換の中のコマンドは、POSIX 準拠モードであるかどうかに関わらず、そのコマンド置換が実行される時に毎回解析されます。
234234
Show on old repository browser