[英]What does $'\n' mean in bash?
這個stackoverflow問題的答案在Linux shell中,如何處理多行字符串的每一行? 提到$'\\n'
是一種特殊語法,“並非在每個shell中都可用”。
我想知道語法是什么意思嗎?
謝謝。
請參見bash
手冊頁的QUOTING
部分:
Words of the form $'string' are treated specially. The word expands to
string, with backslash-escaped characters replaced as specified by the
ANSI C standard. Backslash escape sequences, if present, are decoded as
follows:
...
\n new line
...
The expanded result is single-quoted, as if the dollar sign had not been
present.
該語法不是標准Unix Bourne shell的一部分。 它可能特定於bash,盡管我沒有四處看看是否有其他shell支持它。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.