【发布时间】:2020-05-10 04:44:24
【问题描述】:
是同一个问题 How can I have a newline in a string in sh? 但在鱼壳里。
在 bash 中我们有:
$'this is line\nthis is another line'
谁产生了预期的结果,但在鱼中这不起作用。
fish 有类似的方法吗?
编辑 1:
有 faho 明智地提到的字面方法:
'this is line
this is another line'
但我真的很好奇是否存在将\n 的引用作为 shell 中的换行符的方法。
我想知道我是否可以使用此字符串 "this is a line\nthis is another line" 确保鱼将 \n 视为换行符而不是文字。
【问题讨论】:
-
有趣的是,鱼设计文档describes
$''as "silly" -
非常感谢,有趣的是,现在我明白了鱼壳的立场。
标签: string line-breaks fish